Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GFM header IDs fail if header contains span markup #391

nfagerlund opened this issue Nov 22, 2016 · 5 comments

GFM header IDs fail if header contains span markup #391

nfagerlund opened this issue Nov 22, 2016 · 5 comments


Copy link

On GitHub proper (and kramdown prior to 1.13.0), the following MD:

### `code-span`

...results in the following HTML:

<h3 id="code-span"><code>code-span</code></h3>

Now, though, it results in something like:

<h3 id="-18"><code>code-span</code></h3>

(...assuming this wasn't the first code-span header in the page.)

This is bad, and also does not match what GitHub does.

nfagerlund added a commit to puppetlabs/puppet-docs that referenced this issue Nov 22, 2016

This breaks our header IDs in a very major way.
@gettalong gettalong self-assigned this Nov 23, 2016
@gettalong gettalong added the bug label Nov 23, 2016
Copy link

Thanks for the additional test case, I will release a bug fix release soon that fixes this.

Copy link

In addition the bug fix release will fix problems with entities, smart quotes and other specially parsed kramdown elements.

Copy link

parkr commented Feb 15, 2017

Just upgraded to v1.13.2 and noticing some errors like:

---> Can't handle generic non-integer character reference 'raquo_space'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/utils/entities.rb:323:in `block in <module:Entities>'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/utils/entities.rb:337:in `entity'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/gfm.rb:87:in `block in update_raw_text'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/gfm.rb:89:in `block (2 levels) in update_raw_text'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/gfm.rb:89:in `each'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/gfm.rb:89:in `block in update_raw_text'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/gfm.rb:93:in `update_raw_text'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/kramdown.rb:189:in `block in update_tree'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/kramdown.rb:164:in `map!'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/kramdown.rb:164:in `update_tree'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/kramdown.rb:90:in `parse'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/gfm.rb:44:in `parse'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/base.rb:69:in `parse'
.bundle/ruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/document.rb:107:in `initialize'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/converters/markdown/kramdown_parser.rb:41:in `new'

Could we consider a fallback mechanism for this PR so it doesn't break on headings when it gets confused on the entity?

Copy link

@PARKS Thanks, this is a bug in handling typographic symbols for GFM header IDs - will fix that for the next release.

@gettalong gettalong reopened this Feb 18, 2017
Copy link

The special typographic syms laquo_space and raquo_space are now handled correctly - will be in the next release.

yulijia added a commit to yulijia/ that referenced this issue Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants