65

I'm using the hexo framework and tried adding "---" or "***" in my .md file to get a horizontal line to show up, but it's not working.

Also tried enabling gfm markdown in my _config.yml file:

marked: gfm: true pedantic: false sanitize: false tables: true breaks: true smartLists: true smartypants: true modifyAnchors: '' autolink: true

Any clues? Or is there a way to embed HTML tags to posts?

Joan
  • 905
  • 2
  • 9
  • 15
  • 1
    `
    ` should work in most Markdown editors
    – Stephen Thomas Jun 17 '17 at 23:51
  • Doesn't work. I'm using a markdown renderer (hexo-renderer-marked) but it doesn't seem like the html tag is rendering in my posts. – Joan Jun 18 '17 at 05:57
  • 1
    Have you checked the HTML output? Perhaps the `hr` tag is there but not being displayed due to some CSS rules. Use "view source" in your browser to confirm whether the `hr` tag is in the output. – Waylan Jun 19 '17 at 13:56

4 Answers4

90

--- on a line by itself works for me.

I'm using the Icarus theme, which displays the separator as a dashed line:

enter image description here

As @Waylan commented, your CSS rules are probably preventing your horizonal line to display.

I've also found that preceding the --- line with a <br> line prevents the horizontal line from displaying.

Zodman
  • 3,178
  • 2
  • 32
  • 38
47

tripledash --- has to precede and follow with empty lines to take effect like so


---

thus results in solid line in Markdown

Artem Kozlenkov
  • 975
  • 9
  • 11
14

I know this is old, but for anyone else that runs into this problem what worked for me was to use three underscores instead of three dashes.

___ vs. ---

quixote
  • 195
  • 1
  • 7
  • 1
    I had to do it this way too, because the md file could not process more than one `---` – CloudEmber Apr 21 '22 at 23:05
  • Thanks! both of them works for me with jekyll, however there is a formatting issue on vscode using dashes because the formatter considers three dashes as a begin of front matter section. – Pizaranha Apr 01 '23 at 18:04
6

I know this is old, but I would like to add one thing with markdown. If you put a horizontal line with no new line right after a paragraph like this:

This is text! <!--No new line after paragraph-->
---

The output will be:

This is text!


with the text bolded.

In order to create a horizontal line, you need to put a new line between the paragraph and the
---, like this:

This text is also text! <!-- New line here... -->

---

This is separated text! <!-- ... and new line here. -->

which in markdown makes:


This text is also text!


This is separated text!

Tech Zachary ZN
  • 109
  • 1
  • 3