Skip to content

Commit be92940

Browse files
Fix typos and update content.
1 parent 339000f commit be92940

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

_posts/2023-08-10-PersonalBlogWithJekyll.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ tags: [programming, jekyll]
1414
Jekyll is a static site generator, also called a site builder, that transforms plain text files into static HTML and CSS files. It was written in **Ruby**, and it is open-source and free to use. Jekyll is a popular choice for creating websites and blogs because it is easy to use and produces fast-loading, lightweight websites. Jekyll websites are also easy to deploy and host on any web server.
1515

1616
### A Brief Introduction to Ruby
17-
Ruby was designed and developed in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan. Ruby is known for its elegant syntax, which makes it easy to read and write. Here are some key features of **Ruby**:
17+
**Ruby** was designed and developed in the mid-1990s by *Yukihiro "Matz" Matsumoto* in Japan. Ruby is known for its elegant syntax, which makes it easy to read and write. Here are some key features of **Ruby**:
1818

1919
- Object-oriented: Ruby is an object-oriented language, which means that everything in Ruby is an object. This makes it easy to create reusable code and to encapsulate data.
20-
- Dynamic: Ruby is a dynamic language, which means that the type of a variable can change at runtime. This makes Ruby code more flexible and easier to write.
20+
- Dynamic: Ruby is a dynamic language, which means that the type of variables can change at runtime. This makes Ruby code more flexible and easier to write.
2121
- Reflective: Ruby is a reflective language, which means that Ruby programs can inspect and modify their structure and behavior. This makes it possible to write powerful and flexible code.
2222
- General-purpose: Ruby is a general-purpose language, which means that it can be used to write a wide variety of programs, from web applications to data science scripts.
2323

2424
### Basics of Ruby
2525

26-
- `gem` is a package
27-
- `bundle` is a tool for managing Ruby gem dependencies, similar to `pip` in Python. Bundler has a built-in command to run the project `bundle exec`
26+
- `gem` is a package.
27+
- `bundle` is a tool for managing Ruby gem dependencies, similar to `pip` in Python. Bundler has a built-in command to run the project `bundle exec`.
2828
- `Gemfile` is a text file that describes the gem dependencies required to execute associated Ruby code.
29-
- `Gemfile.lock` is a text file that specifies the exact versions of the gems that were installed
29+
- `Gemfile.lock` is a text file that specifies the exact versions of the gems that were installed.
3030
- `bundle install` will install all gems listed in the `Gemfile` with specific versions listed in the `Gemfile.lock`. This command will set up everything for the application.
3131
- `gem install` will install gems for your own environment.
3232

@@ -35,7 +35,7 @@ Ruby was designed and developed in the mid-1990s by Yukihiro "Matz" Matsumoto in
3535
```bash
3636
$ which ruby
3737
/usr/bin/ruby
38-
# This means you are using the ruby preinstalled by MacOS, which is often outdated.
38+
# This means you are using the ruby preinstalled by macOS, which is often outdated.
3939
# Scripting language runtimes such as Python, Ruby, and Perl are included in macOS
4040
# by default for compatibility with legacy software.
4141
```
@@ -45,7 +45,7 @@ $ which ruby
4545
> There are other options, feel free to explore them.
4646
{: .prompt-tip}
4747

48-
#### Install [Homebrew](https://brew.sh/)
48+
#### Install [homebrew](https://brew.sh/)
4949

5050
Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple's operating system, macOS, as well as Linux. It's also written in Ruby.
5151

@@ -56,7 +56,7 @@ https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
5656

5757
#### Install [rbenv](https://github.com/rbenv/rbenv)
5858

59-
rbenv is a version manager tool for the Ruby programming language on Unix-like systems. It is useful for switching between multiple Ruby versions on the same machine and for ensuring that each project you are working on always runs on the correct Ruby version.
59+
**rbenv** is a version manager tool for the Ruby programming language on Unix-like systems. It is useful for switching between multiple Ruby versions on the same machine and for ensuring that each project you are working on always runs on the correct Ruby version.
6060

6161
```bash
6262
# Install rbenv
@@ -115,6 +115,14 @@ $ bundle exec jekyll serve --host=0.0.0.0
115115
# By using --host=0.0.0.0, you can access your jekyll site with http://host_machine_ip:4000/
116116
```
117117

118+
I recommend create a script (`run.sh` in my case) that will delete the generated site cache first then start a new one (because in many cases, the cache prevents me from accessing my new posts). Here is the script I'm using:
119+
120+
```bash
121+
[ -d "_site" ] && rm -r _site
122+
[ -d ".jekyll-cache" ] && rm -r .jekyll-cache
123+
bundle exec jekyll serve --host=0.0.0.0 --incremental
124+
```
125+
118126
### Jekyll Plugins
119127

120128
To add plugins to your Jekyll site, just add a new section in your `_config.yml` and gems in `Gemfile`. Here are the plugins I'm using:
@@ -142,7 +150,7 @@ end
142150

143151
#### Jekyll-Scholar for Academic Scholars
144152

145-
Create a new folder `_bibliography` at the project root, and add your [configuration](https://github.com/inukshuk/jekyll-scholar#configuration) in `_config.yml`
153+
Create a new folder `_bibliography` at the project root, and add your [configuration](https://github.com/inukshuk/jekyll-scholar#configuration) in `_config.yml`.
146154

147155
```yaml
148156
scholar:
@@ -176,7 +184,7 @@ You can have a default `.bib` file to store all of your references, but I prefer
176184
}
177185
```
178186

179-
To add a reference at the end of the post, put the following lines at the end of the markdown file. Note that the argument `papers_cv` is from the file name `papers_cv.bib`. A preview can be found in my computer vision notes [here](https://zhengyuan-public.github.io/posts/ComputerVisionNotes/#reference).
187+
To add a reference at the end of the post, put the following lines at the end of the markdown file. Note that the argument `papers_cv` is from the file name `papers_cv.bib`. A preview can be found in my computer vision notes [here](https://zhengyuan-public.github.io/posts/ObjectDetectionNotes/#reference).
180188

181189

182190
{% raw %}
@@ -190,26 +198,29 @@ To add a reference at the end of the post, put the following lines at the end of
190198
{% endraw %}
191199

192200
To cite the above-mentioned two papers within the post, use the following syntax. They will be rendered as {% cite girshick2014rich --file papers_aio %} and {% cite he2015spatial --file papers_aio %}.
193-
{% raw %}
194201

202+
{% raw %}
195203
```liquid
196204
{% cite girshick2014rich --file papers_aio %} and {% cite he2015spatial --file papers_aio %}
197205
```
198206
{% endraw %}
199207

200208
## $$ \LaTeX $$ Math Equations in Jekyll
201209

210+
> The updated math usage with Chirpy can be found [here](https://chirpy.cotes.page/posts/write-a-new-post/#mathematics).
211+
{: .prompt-tip}
212+
202213
For Jekyll, the procedures to render $$ \LaTeX $$ math equations are:
203214

204215
$$
205216
\text{Markdown} \xrightarrow[]{kramdown} \text{HTML} \xrightarrow[]{MathJax} \text{Math Equation Images}
206217
$$
207218

208-
Where kramdown is the markdown engine used by Jekyll (and GitHub) for translating markdown into HTML, and MathJax is a JavaScript that renders the HTML as images shown on the website. It should be noticed that kramdown has a slightly different syntax compared to standard markdown (see details [here](https://kramdown.gettalong.org/syntax.html#math-blocks)). I encountered several problems with inline math rendering (see examples [here](https://github.com/mathjax/MathJax/issues/3103)) and here I'd like to summarize my findings on how to avoid those problems.
219+
Where **kramdown** is the markdown engine used by Jekyll (and GitHub) for translating markdown into HTML, and **MathJax** is a JavaScript that renders the HTML as images shown on the website. It should be noticed that kramdown has a slightly different syntax compared to standard markdown (see details [here](https://kramdown.gettalong.org/syntax.html#math-blocks)). I encountered several problems with inline math rendering (see examples [here](https://github.com/mathjax/MathJax/issues/3103)) and here I'd like to summarize my findings on how to avoid those problems.
209220

210-
I usually start writing my notes on Jekyll with Typora (which has its private markdown engine and it works better than kramdown in my humble opinion) and then revise it until it's ready for publication on GitHub. However, the rendered outputs on Jekyll are not always the same as in Typora because of their differences in the markdown engine.
221+
I usually start writing my markdown notes with *Typora* (It has its private markdown engine and it works better than *kramdown* in my humble opinion). Then I will revise it until it's ready for publication on GitHub. However, the rendered outputs on Jekyll are not always the same as in *Typora* because of their differences in the markdown engine.
211222

212-
In standard markdown syntax, you should add inline math with `$ math $` and block math with `$$ math $$`. However, the situation is a little complicated in kramdown. If you are not interested in the examples, just jump to the [summary](#summary).
223+
In standard markdown syntax, you should add inline math with `$ math $` and block math with `$$ math $$`. However, the situation is a little complicated in *kramdown*. If you are not interested in the examples, just jump to the [summary](#summary).
213224

214225
> Here are just the temporary solutions I've found. I believe this is a bug in kramdown, so I'll start an issue and update this part accordingly.
215226
{: .prompt-warning }
@@ -502,7 +513,7 @@ There’s no specific number of categories that you should have. In most cases,
502513
[URLs and links in Jekyll](https://mademistakes.com/mastering-jekyll/how-to-link/) :link:
503514

504515
1. Reference the post’s full root-relative URL.
505-
2. Use the {% raw %} `{% post_url %}` {% endraw %} tag. This tag will automatically generate the correct root-relative URL to the post, regardless of your permalink structure. **(Recommended)**
516+
2. Use the {% raw %} `{% post_url %}` {% endraw %} tag. This tag will automatically generate the correct root-relative URL to the post, regardless of your permalink structure **(Recommended)**.
506517
3. Use {% raw %} `{% link %}` {% endraw %}. This tag is more general and can be used to link to any file or directory on your site, including posts, pages, collections, and static assets.
507518

508519
Examples:

0 commit comments

Comments
 (0)