Parse header IDs with colons #72

Closed
MattiSG opened this Issue Aug 8, 2013 · 7 comments

Projects

None yet

3 participants

MattiSG commented Aug 8, 2013

Kramdown does not parse valid HTML IDs for the {#} anchor syntax, and differs from PHP Markdown Extra behavior on header IDs:

# Header {#id:with-a-colon}

Parsed by Kramdown as:

<h1 id="header-idwith-a-colon">Header {#id:with-a-colon}</h1>

Expected (and properly parsed by PHP Markdown Extras):

<h1 id="id:with-a-colon">Header</h1>

Also, the HTML spec explicitly states:

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

Source

svnpenn commented Aug 8, 2013

You cannot use a Span IAL with a Block-Level Element AKA <h1>

kramdown.rubyforge.org/syntax.html#inline-attribute-lists

Proper syntax

$ cat foo.md
{:#with:colon}
# Header

$ kramdown foo.md
<h1 id="with:colon">Header</h1>
MattiSG commented Aug 9, 2013

This is not an IAL, this is a Header ID. Notice there is no colon between the opening curly bracket and the hash :)

Le 9 août 2013 à 01:00, Steven Penny notifications@github.com a écrit :

You cannot use a Span IAL with a Block-Level Element AKA

kramdown.rubyforge.org/syntax.html#inline-attribute-lists

Proper syntax

$ cat foo.md
{:#with:colon}

Header

$ kramdown foo.md

Header


Reply to this email directly or view it on GitHub.

@gettalong gettalong was assigned Aug 9, 2013
Owner

Thanks for finding this bug! Using a header ID and an IAL should definitely work the same, so I will add support for the colon to the header ID.

Owner

Implemented.

@gettalong gettalong closed this Aug 21, 2013
MattiSG commented Aug 26, 2013

Cool, thanks!

Any ETA on this being available on RubyGems? :)

Owner

I would like to incorporate one more patch and then release a new version, so probably this week.

MattiSG commented Aug 27, 2013

Great, thanks Thomas! :)

Le 27 août 2013 à 07:44, Thomas Leitner notifications@github.com a écrit :

I would like to incorporate one more patch and then release a new version, so probably this week.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment