thephpleague / html-to-markdown

Convert HTML to Markdown with PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Horizontal rules use non-standard format

multiwebinc opened this issue · comments

Version(s) affected

5.0.2

Description

According to https://www.markdownguide.org/basic-syntax/#horizontal-rules

To create a horizontal rule, use three or more asterisks (***), dashes (---), or underscores (___) on a line by themselves.

This library, instead, uses - - - - - -, which would appear to be non-standard from everywhere I could find.

This causes an issue (for example) with https://github.com/erusev/parsedown when you have an unordered list followed by a horizontal rule. When parsed as HTML, the <hr> is appended to an additional <li> inside the list instead of being after the list.

How to reproduce

<hr>

This library aims to follow the CommonMark specification which as the authoritative source on valid Markdown. This spec does recognize both styles but it sounds like Parsedown might not support this spec?

Regardless, I'm not opposed to changing the output to be more friendly with non-CommonMark-compliant parsers so long as that output remains CommonMark-compliant. So if you or anyone else would like to modify that output to be --- or something similar I'd be open to accepting that PR :)

Thanks @colinodell. I wasn't aware of that spec. I've therefore reported a bug in the Parsedown repo erusev/parsedown#818. Unfortunately, the code for the parser there hasn't been updated for 3 years now, so who knows...