khajavi / pandoc

Automatically exported from code.google.com/p/pandoc
GNU General Public License v2.0
0 stars 0 forks source link

problem with #id links when id contains spaces #206

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Bug noted by Colin Adams:

Run pandoc on this input

---
Several moves have been tried for White, but only [P 4e -4f](#4.P 4e -
4f) works reasonably:

and later:

#4.P 4e - 4f
--- 
<p
  >Several moves have been tried for White, but only <a href="#4.P+4e+-
+4f"
    >P 4e –4f</a
    > works reasonably:</p
  >

and:

<div id="p-4e---4f"
  ><h1
    ><a href="#TOC"
      >4.P 4e - 4f</a
      ></h1
    >

Original issue reported on code.google.com by fiddloso...@gmail.com on 17 Jan 2010 at 5:51

GoogleCodeExporter commented 9 years ago

Original comment by fiddloso...@gmail.com on 17 Jan 2010 at 5:52

GoogleCodeExporter commented 9 years ago
My mistake: this is not a bug. See
http://johnmacfarlane.net/pandoc/README.html#header-identifiers-in-html

Html ID attributes cannot contain spaces.  For that reason, the
id pandoc generates from a title will replace the spaces with hyphens,
as explained in the manual.  It also replaces uppercase with lowercase.
Hence, for the title "P 4e - 4f", the id is:

id="p-4e---4f

This looks a bit weird, because you already had a hyphen in the title.
But the rule is being followed, and it is simple enough to remember.
So, if you want to link to this header, you have to use the generated
id: 
Several moves have been tried for White, but only 
[P 4e -4f](#4.p-4e---4f) works reasonably:

Original comment by fiddloso...@gmail.com on 17 Jan 2010 at 6:13