jgm / pandoc

Universal markup converter
https://pandoc.org
Other
33.96k stars 3.35k forks source link

Unification spaces of titles #809

Closed romanmatyus closed 11 years ago

romanmatyus commented 11 years ago

I get from markdown

# Popis riešenia

## Schéma

## Lokalizácia

## Prístupové práva

HTML

<h1 id="popis-riešenia"> Popis riešenia</h1>
<h2 id="schéma">Schéma</h2>
<h2 id="lokalizácia">Lokalizácia</h2>
<h2 id="prístupové-práva"> Prístupové práva</h2>

instead

<h1 id="popis-riešenia">Popis riešenia</h1>
<h2 id="schéma">Schéma</h2>
<h2 id="lokalizácia">Lokalizácia</h2>
<h2 id="prístupové-práva">Prístupové práva</h2>

In HTML it's not problem (browser ignores spaces), but this problem is reflected e.g. in PDF output. Titles is not generated equally and e.g. in table of content are not aligned.

Obrazovka z 2013-03-29 23:56:58

jgm commented 11 years ago

I'm not seeing any of the strange spacing behavior you're reporting. What version of pandoc did you use, how did you install it, and what is the exact command you are using to convert? You might also try reproducing on http://johnmacfarlane.net/pandoc/try

+++ Roman Mátyus [Mar 29 13 16:05 ]:

I get from markdown

Popis riesenia

Sch�ma

Lokaliz�cia

Pr�stupov� pr�va

HTML

Popis riesenia

Sch�ma

Lokaliz�cia

Pr�stupov� pr�va

instead

Popis riesenia

Sch�ma

Lokaliz�cia

Pr�stupov� pr�va

In HTML it's not problem (browser ignores spaces), but this problem is reflected e.g. in PDF output. Titles is not generated equally and e.g. in table of content are not aligned.

[1]Obrazovka z 2013-03-29 23:56:58

-- Reply to this email directly or [2]view it on GitHub. [xJAuenYDiIoVt3LF3y6846jC6RUuOZBElF23PZ9K4YNtwUoa_MpprU05q_9cwV8t.gif]

References

  1. https://f.cloud.github.com/assets/1110294/319500/7f2cc66a-98c4-11e2-9328-4bcc8db96657.png
  2. https://github.com/jgm/pandoc/issues/809
romanmatyus commented 11 years ago
$ ~/.cabal/bin/pandoc -v
pandoc 1.11.1
Compiled with citeproc-hs 0.3.8, texmath 0.6.1.3, highlighting-kate 0.5.3.8.
Syntax highlighting is supported for the following languages:
    actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog,
    clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d,
    diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang,
    fortran, fsharp, gnuassembler, go, haskell, haxe, html, ini, java, javadoc,
    javascript, json, jsp, julia, latex, lex, literatecurry, literatehaskell,
    lua, makefile, mandoc, matlab, maxima, metafont, mips, modula2, modula3,
    monobasic, nasm, noweb, objectivec, objectivecpp, ocaml, octave, pascal,
    perl, php, pike, postscript, prolog, python, r, relaxngcompact, rhtml, ruby,
    rust, scala, scheme, sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl,
    texinfo, verilog, vhdl, xml, xorg, xslt, xul, yacc, yaml
Default user data directory: /home/roman/.pandoc
Copyright (C) 2006-2013 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.
$ ~/.cabal/bin/pandoc test.md -o test.html

I install by

$ cabal update
$ cabal install pandoc
jgm commented 11 years ago

I can't reproduce what you're seeing. See Try pandoc. Everything looks fine.

What exact pandoc command are you using to convert your input? For diagnostics, can you try it with pandoc -t native and post the result?

romanmatyus commented 11 years ago

Strange behavior. Now, when I create new file with markup text from first comment, I get correct output.

But, when I use different input, I get again bad output.

input test.md:

# Návod na prevod detailného návrhu do PDF

## Inštalácia prostredia

## Prevod do PDF
$ ~/.cabal/bin/pandoc test.md -o test.html

output:

<h1 id="návod-na-prevod-detailného-návrhu-do-pdf">Návod na prevod detailného návrhu do PDF</h1>
<h2 id="inštalácia-prostredia"> Inštalácia prostredia</h2>
<h2 id="prevod-do-pdf"> Prevod do PDF</h2>

$ ~/.cabal/bin/pandoc test.md -o test.html

oputput:

[Header 1 ("n\225vod-na-prevod-detailn\233ho-n\225vrhu-do-pdf",[],[]) [Str "N\225vod",Space,Str "na",Space,Str "prevod",Space,Str "detailn\233ho",Space,Str "n\225vrhu",Space,Str "do",Space,Str "PDF"]
,Header 2 ("in\353tal\225cia-prostredia",[],[]) [Str "\160In\353tal\225cia",Space,Str "prostredia"]
,Header 2 ("prevod-do-pdf",[],[]) [Str "\160Prevod",Space,Str "do",Space,Str "PDF"]]

pandoc version:

$ ~/.cabal/bin/pandoc -v
pandoc 1.11.1
Compiled with citeproc-hs 0.3.8, texmath 0.6.1.3, highlighting-kate 0.5.3.8.
Syntax highlighting is supported for the following languages:
    actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog,
    clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d,
    diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang,
    fortran, fsharp, gnuassembler, go, haskell, haxe, html, ini, java, javadoc,
    javascript, json, jsp, julia, latex, lex, literatecurry, literatehaskell,
    lua, makefile, mandoc, matlab, maxima, metafont, mips, modula2, modula3,
    monobasic, nasm, noweb, objectivec, objectivecpp, ocaml, octave, pascal,
    perl, php, pike, postscript, prolog, python, r, relaxngcompact, rhtml, ruby,
    rust, scala, scheme, sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl,
    texinfo, verilog, vhdl, xml, xorg, xslt, xul, yacc, yaml
Default user data directory: /home/roman/.pandoc
Copyright (C) 2006-2013 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.

PS: For case if is input file bad on byte level, I send original input file: http://ulozto.sk/xusgJrD/test-md

romanmatyus commented 11 years ago

See Try Pandoc - fails!

I really not find terms with that entry fails. I do not see a relation.

Obrazovka z 2013-03-30 20:56:14

jgm commented 11 years ago

+++ Roman Mátyus [Mar 30 13 12:55 ]:

N�vod na prevod detailn�ho n�v rhu do PDF

Instal�cia prostredia

Prevod do PDF

 __________________________________________________________________

$ ~/.cabal/bin/pandoc test.md -o test.html

oputput: [Header 1 ("n\225vod-na-prevod-detailn\233ho-n\225vrhu-do-pdf",[],[]) [Str "N\22 5vod",Space,Str "na",Space,Str "prevod",Space,Str "detailn\233ho",Space,Str "n\2 25vrhu",Space,Str "do",Space,Str "PDF"] ,Header 2 ("in\353tal\225cia-prostredia",[],[]) [Str "\160In\353tal\225cia",Spac e,Str "prostredia"] ,Header 2 ("prevod-do-pdf",[],[]) [Str "\160Prevod",Space,Str "do",Space,Str "PD F"]]

Note the \160 (a nonbreaking space) at the beginning of the string inside the headers.

The most likely reason this would be there is if your input contains a nonbreaking space between the ## and the first letter. Just use a regular space there and you should be fine.

romanmatyus commented 11 years ago

Yes, thanks. I understand.

But by my it's bug. Minimal it's not expected behavior.

I vote for crop input about nonprinting characters. Bad idea? Current stats can cause WTF effect (like me).

jgm commented 11 years ago

No, I don't regard it as a bug. Nonbreaking spaces are never ignored in pandoc, and that's a feature -- for those rare cases where you really want a space.

+++ Roman Mátyus [Mar 30 13 15:18 ]:

Yes, thanks. I understand.

But by my it's bug. Minimal it's not expected behavior.

I vote for crop input about nonprinting characters. Bad idea? Current stats can cause WTF effect (like me).

-- Reply to this email directly or [1]view it on GitHub. [xJAuenYDiIoVt3LF3y6846jC6RUuOZBElF23PZ9K4YNtwUoa_MpprU05q_9cwV8t.gif]

References

  1. https://github.com/jgm/pandoc/issues/809#issuecomment-15682932
romanmatyus commented 11 years ago

I do not think totally ignore. My idea is only on start and end titles. In this case is not reason for their existence.

jgm commented 11 years ago

In my view it is best to be consistent in treatment of nonbreaking spaces, and not second guess what users might want to do.

+++ Roman Mátyus [Mar 30 13 15:29 ]:

I do not think totally ignore. My idea is only on start and end titles. In this case is not reason for their existence.

-- Reply to this email directly or [1]view it on GitHub. [xJAuenYDiIoVt3LF3y6846jC6RUuOZBElF23PZ9K4YNtwUoa_MpprU05q_9cwV8t.gif]

References

  1. https://github.com/jgm/pandoc/issues/809#issuecomment-15683073
romanmatyus commented 11 years ago

Ok.

Thanks for your work.