Pandoc ignores Markdown-Headlines

Using snap , I wrote a splice to create markdown text using this function:

markdownToHTML :: T.Text -> [Node] markdownToHTML = renderHtmlNodes . (writeHtml writeOpts) . readMarkdown readOpts . T.unpack where readOpts = defaultParserState writeOpts = defaultWriterOptions { writerStandalone = False , writerHtml5 = True , writerStrictMarkdown = False } 

Now when I, for example, give him this markdown

 # Hi Lorem ipsum something somthing # Stuff [a link](http://twitter.com/) 

It creates this HTML code:

 <h1 id='hi'>Hi </h1> <p> Lorem ipsum something somthing # Stuff <a href='http://twitter.com/'>a link</a></p> 

No matter how many lines I put in front of # , it still just wedged into the paragraph.

Oddly enough, if I uncheck the same mark in the pandoc demo site, it produces the correct HTML output.

The full code for my project can be found here , if necessary.

+4
source share
1 answer

See the documentation for Text.Pandoc. It says:

Note: all readers assume that the input text has a line ending \\ n. Therefore, if you get input text from a web form, you must remove the characters "\ r" with the filter (/ = '\ r').

I suspect your problem.

+6
source

Source: https://habr.com/ru/post/1411091/


All Articles