demydd / pandoc

Automatically exported from code.google.com/p/pandoc
0 stars 0 forks source link

Header identifiers in HTML starting with numbers #33

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a document that contains this line only: "# 1 Test"
2. Run "pandoc -st html test.txt > test.html".

What is the expected output? What do you see instead?

The output should contain a valid ID for the HTML h1 tag. However, the
identifier is "1-test", which is not a valid identifier because identifiers
may not begin with a number (see
http://htmlhelp.com/reference/html40/attrs.html).

Running this through HTML Tidy will result in the following warning: 'line
10 column 4 - Warning: <h1> attribute "id" has invalid value "1-test"'.

What version of the product are you using? On what operating system?

I'm using revision 1145 checked out from the SVN repository on Windows
under Cygwin.

Original issue reported on code.google.com by dnagle.u...@gmail.com on 10 Dec 2007 at 3:21

GoogleCodeExporter commented 8 years ago
Thanks for the bug report.  Do you have any suggestions for what the
automatically-generated identifier should be for "# 1 Test"?
One possibility would be to strip off everything until we hit a
character in the range [A-Za-z], so...

# 1 Test   ==>  test
# 1. Test  ==>  test
# (1) Test ==>  test
# 3 Case Studies ==> case-studies

Original comment by fiddloso...@gmail.com on 10 Dec 2007 at 3:38

GoogleCodeExporter commented 8 years ago
I think your suggested possibility makes sense as a good way to handle it. It 
makes
the output very predictable. I can't really think of anything else that would 
make a
good default.

I can think of additional options that someone might conceivably find useful 
(like
optionally prepending a string like "section-" to yield "section-1-heading"), 
but I
have my doubts that they'd be used enough to warrant adding them. I'd probably 
stick
with the default myself even. :)

Original comment by dnagle.u...@gmail.com on 10 Dec 2007 at 5:36

GoogleCodeExporter commented 8 years ago
Fixed in r1150.

Original comment by fiddloso...@gmail.com on 21 Dec 2007 at 7:26