Displaying images in Hexo with Markdown.
File locations of the images
This is straightforward and is discussed in the official documentation. There are two ways. One is to put all images in the so-called global asset folder
, source/images
, and all posts will need to refer to the images using the path /images/[FILENAME]
. The other way is to enable the post asset folder
by setting the following flag in _config.yml
,
In this case, the images will be stored separately in a folder of the same name as the post file name. In the post, the image is inserted using the path [FILENAME]
. A similar discussion can be found here.
Displaying the images
Using Markdown
The image capabilities of Markdown depends on its implementation. The basic approach can be found here
Some implementations of Markdown support the sizing of the image as discussed here.
Unfortunately, it seems the current Markdown engine pandoc
does not support the sizing.
An example is shown as follows,
Using HTML
The HTML can be embedded into Markdown. So fancier image displaying can be achieved using HTML snippets. Note that there is also another approach that is based on CSS (an example). However, CSS more or less makes the file structure more complicated.
The basic format is, but not limited to,
Note that one can use the style
keyword to define the size and alignment, etc. For example,
Finally, <img>
can be combined with <p></p>
, <figure></figure>
, etc to achieve other formatting purposes.
The following are some examples. Hover the cursor on the image to see the title.
|
|
|
|
|
|
|
|
|
|
|
|
More references: