<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title xmlns:ns="http://www.w3.org/2005/Atom" ns:type="text">Markdown – Haskell – Aelve Guide</title><id>https://guide.aelve.com/haskell/feed/category/hm7miz9n</id><updated>2016-04-11T20:57:13Z</updated><link xmlns:ns="http://www.w3.org/2005/Atom" ns:href="https://guide.aelve.com/haskell/feed/category/hm7miz9n"/><entry><id>rgim1lvh</id><title xmlns:ns="http://www.w3.org/2005/Atom" ns:type="text">discount</title><updated>2016-04-11T20:57:13Z</updated><content xmlns:ns="http://www.w3.org/2005/Atom" ns:type="html">&lt;h1&gt;  &lt;a href=&#34;http://www.pell.portland.or.us/~orc/Code/discount/&#34; class=&#34;item-name&#34;&gt;discount&lt;/a&gt;

  
  (&lt;a href=&#34;https://hackage.haskell.org/package/discount&#34;&gt;Hackage&lt;/a&gt;)
&lt;/h1&gt;&lt;p&gt;Bindings to another Markdown library, &lt;a href=&#34;http://www.pell.portland.or.us/%7Eorc/Code/discount/&#34;&gt;discount&lt;/a&gt;. Can convert Markdown to HTML, but doesn&#39;t give access to parsed Markdown.&lt;/p&gt;
&lt;p&gt;The documentation for Markdown extensions it supports can be found &lt;a href=&#34;http://www.pell.portland.or.us/%7Eorc/Code/discount/#Language.extensions&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Pros&lt;/h2&gt;&lt;ul&gt;&lt;p&gt;&lt;li&gt;Supports tables, superscripts, strikethrough, footnotes.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Has some non-standard extensions too: definition lists, paragraph centering, specifying image sizes, and styling text (e.g. &lt;code&gt;[foo](class:bar)&lt;/code&gt; would wrap “foo” into a &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; tag with &lt;code&gt;class=&amp;quot;bar&amp;quot;&lt;/code&gt; and then you could apply CSS styling to it).&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;&lt;em&gt;Seems&lt;/em&gt; to be able to deal with any input with linear performance (since it renders &lt;a href=&#34;https://github.com/jgm/cmark-hs/blob/master/bench/full-sample.md&#34;&gt;this stress-test&lt;/a&gt; just fine).&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Supports math in pages (with &lt;a href=&#34;https://www.mathjax.org/&#34;&gt;MathJax&lt;/a&gt;).&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Can generate table of contents.&lt;/li&gt;&lt;/p&gt;&lt;/ul&gt;&lt;h2&gt;Cons&lt;/h2&gt;&lt;ul&gt;&lt;p&gt;&lt;li&gt;The library has to be installed separately.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Its dialect of Markdown is rather non-standard.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Doesn&#39;t have code blocks with attributes (so, no code highlighting).&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Doesn&#39;t provide a Haskell type for parsed Markdown (so you can&#39;t inspect or modify it).&lt;/li&gt;&lt;/p&gt;&lt;/ul&gt;</content><link xmlns:ns="http://www.w3.org/2005/Atom" ns:href="https://guide.aelve.com/haskell/markdown-hm7miz9n#item-rgim1lvh"/></entry><entry><id>vm16nvh7</id><title xmlns:ns="http://www.w3.org/2005/Atom" ns:type="text">sundown</title><updated>2016-04-11T20:56:27Z</updated><content xmlns:ns="http://www.w3.org/2005/Atom" ns:type="html">&lt;h1&gt;  &lt;a href=&#34;https://github.com/vmg/sundown&#34; class=&#34;item-name&#34;&gt;sundown&lt;/a&gt;

  
  (&lt;a href=&#34;https://hackage.haskell.org/package/sundown&#34;&gt;Hackage&lt;/a&gt;)
&lt;/h1&gt;&lt;p&gt;Bindings to Github&#39;s (former) Markdown library, &lt;a href=&#34;https://github.com/vmg/sundown&#34;&gt;sundown&lt;/a&gt;. (The sources are bundled with the package, so the library doesn&#39;t need to be installed separately.) Can convert Markdown to HTML, but doesn&#39;t give access to parsed Markdown.&lt;/p&gt;
&lt;h2&gt;Pros&lt;/h2&gt;&lt;ul&gt;&lt;p&gt;&lt;li&gt;Very fast (since it&#39;s a C library). Can deal with any input with linear performance, and has been battle-tested extensively (since it&#39;s been used on Github).&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Supports automatic link recognition.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Has support for tables, superscripts, strikethrough.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Can generate a table of contents.&lt;/li&gt;&lt;/p&gt;&lt;/ul&gt;&lt;h2&gt;Cons&lt;/h2&gt;&lt;ul&gt;&lt;p&gt;&lt;li&gt;The underlying library (sundown) has been deprecated.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Doesn&#39;t provide a Haskell type for parsed Markdown (so you can&#39;t inspect or modify it).&lt;/li&gt;&lt;/p&gt;&lt;/ul&gt;</content><link xmlns:ns="http://www.w3.org/2005/Atom" ns:href="https://guide.aelve.com/haskell/markdown-hm7miz9n#item-vm16nvh7"/></entry><entry><id>yowt68nb</id><title xmlns:ns="http://www.w3.org/2005/Atom" ns:type="text">markdown</title><updated>2016-04-11T20:55:27Z</updated><content xmlns:ns="http://www.w3.org/2005/Atom" ns:type="html">&lt;h1&gt;  &lt;span class=&#34;item-name&#34;&gt;markdown&lt;/span&gt;

  
  (&lt;a href=&#34;https://hackage.haskell.org/package/markdown&#34;&gt;Hackage&lt;/a&gt;)
&lt;/h1&gt;&lt;p&gt;A library from Michael Snoyman (the author of Yesod). Can parse Markdown and convert it to HTML. Has additional features that make it good for publishing (you can customise the parser, for instance) but simultaneously can get stuck on some inputs and that&#39;s pretty bad (unless you explicitly implement a timeout or something like that).&lt;/p&gt;
&lt;h2&gt;Pros&lt;/h2&gt;&lt;ul&gt;&lt;p&gt;&lt;li&gt;Sanitizes input by default.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;The parser can be customised to add new kinds of fencing in addition to &lt;code&gt;```&lt;/code&gt; and &lt;code&gt;~~~&lt;/code&gt; – for instance, &lt;code&gt;@@@&lt;/code&gt;. Moreover, the contents can be parsed as Markdown as well (so you could set it up so that e.g. &lt;code&gt;@@@&lt;/code&gt; would mean “spoiler” or “important note”).&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Has an option for adding &lt;code&gt;target=_blank&lt;/code&gt; to all links so that they&#39;d open in new tabs.&lt;/li&gt;&lt;/p&gt;&lt;/ul&gt;&lt;h2&gt;Cons&lt;/h2&gt;&lt;ul&gt;&lt;p&gt;&lt;li&gt;Doesn&#39;t handle pathological inputs well (e.g. parsing &lt;code&gt;[[[[[[[[[[[[[[[[[[[[[[[ foo ]]]]]]]]]]]]]]]]]]]]]]]&lt;/code&gt; takes 46s on my machine), which makes it unsuitable for e.g. sites with user-submitted content.&lt;/li&gt;&lt;/p&gt;&lt;/ul&gt;&lt;h2&gt;Ecosystem&lt;/h2&gt;&lt;p&gt;&lt;a href=&#34;https://hackage.haskell.org/package/yesod-text-markdown&#34;&gt;yesod-text-markdown&lt;/a&gt;&lt;/p&gt;
</content><link xmlns:ns="http://www.w3.org/2005/Atom" ns:href="https://guide.aelve.com/haskell/markdown-hm7miz9n#item-yowt68nb"/></entry><entry><id>bs2xaisu</id><title xmlns:ns="http://www.w3.org/2005/Atom" ns:type="text">cheapskate</title><updated>2016-04-11T20:55:02Z</updated><content xmlns:ns="http://www.w3.org/2005/Atom" ns:type="html">&lt;h1&gt;  &lt;a href=&#34;https://github.com/jgm/cheapskate&#34; class=&#34;item-name&#34;&gt;cheapskate&lt;/a&gt;

  
  (&lt;a href=&#34;https://hackage.haskell.org/package/cheapskate&#34;&gt;Hackage&lt;/a&gt;)
&lt;/h1&gt;&lt;p&gt;Another lightweight Markdown library from the author of Pandoc. Unlike &lt;a href=&#34;https://hackage.haskell.org/package/cmark&#34;&gt;cmark&lt;/a&gt;, it&#39;s implemented in pure Haskell. Can parse Markdown and convert it to HTML.&lt;/p&gt;
&lt;h2&gt;Pros&lt;/h2&gt;&lt;ul&gt;&lt;p&gt;&lt;li&gt;Can deal with any input with linear performance.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;HTML output is &lt;a href=&#34;https://hackage.haskell.org/package/xss-sanitize&#34;&gt;sanitized&lt;/a&gt; by default (to protect against XSS attacks).&lt;/li&gt;&lt;/p&gt;&lt;/ul&gt;&lt;h2&gt;Cons&lt;/h2&gt;&lt;ul&gt;&lt;/ul&gt;&lt;h2&gt;Ecosystem&lt;/h2&gt;&lt;p&gt;&lt;a href=&#34;https://hackage.haskell.org/package/cheapskate-terminal&#34;&gt;cheapskate-terminal&lt;/a&gt; (renders to console),
&lt;a href=&#34;https://hackage.haskell.org/package/cheapskate-highlight&#34;&gt;cheapskate-highlight&lt;/a&gt; (highlights code blocks),
&lt;a href=&#34;https://hackage.haskell.org/package/cheapskate-lucid&#34;&gt;cheapskate-lucid&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Notes&lt;/h2&gt;&lt;h1&gt;&lt;span id=&#34;item-notes-bs2xaisu-imports&#34;&gt;&lt;/span&gt;Imports&lt;/h1&gt;&lt;div class=&#34;sourceCode&#34;&gt;&lt;pre class=&#34;sourceCode&#34;&gt;&lt;code class=&#34;sourceCode&#34;&gt;&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Cheapskate&lt;/span&gt;
&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Cheapskate.Html&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And these are imports from &lt;a href=&#34;https://hackage.haskell.org/package/blaze-html&#34;&gt;blaze-html&lt;/a&gt; that you&#39;ll need if you want to render HTML:&lt;/p&gt;
&lt;div class=&#34;sourceCode&#34;&gt;&lt;pre class=&#34;sourceCode&#34;&gt;&lt;code class=&#34;sourceCode&#34;&gt;&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Text.Blaze.Html&lt;/span&gt; (&lt;span class=&#34;dt&#34;&gt;Html&lt;/span&gt;)

&lt;span class=&#34;co&#34;&gt;-- for rendering to ByteString&lt;/span&gt;
&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Text.Blaze.Html.Renderer.Utf8&lt;/span&gt; (renderHtml)

&lt;span class=&#34;co&#34;&gt;-- or for rendering to Text&lt;/span&gt;
&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Text.Blaze.Html.Renderer.Text&lt;/span&gt; (renderHtml)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;&lt;span id=&#34;item-notes-bs2xaisu-usage&#34;&gt;&lt;/span&gt;Usage&lt;/h1&gt;&lt;p&gt;First of all, you should know what options cheapskate will use.
By default, &lt;code&gt;sanitize&lt;/code&gt; and &lt;code&gt;allowRawHtml&lt;/code&gt; are enabled:&lt;/p&gt;
&lt;div class=&#34;sourceCode&#34;&gt;&lt;pre class=&#34;sourceCode&#34;&gt;&lt;code class=&#34;sourceCode&#34;&gt;&lt;span class=&#34;kw&#34;&gt;data&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Options&lt;/span&gt; &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Options&lt;/span&gt; {
&lt;span class=&#34;ot&#34;&gt;  sanitize           ::&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Bool&lt;/span&gt;,   &lt;span class=&#34;co&#34;&gt;-- ^ Sanitize raw HTML, link/image attributes&lt;/span&gt;
&lt;span class=&#34;ot&#34;&gt;  allowRawHtml       ::&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Bool&lt;/span&gt;,   &lt;span class=&#34;co&#34;&gt;-- ^ Allow raw HTML (if false it gets escaped)&lt;/span&gt;
&lt;span class=&#34;ot&#34;&gt;  preserveHardBreaks ::&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Bool&lt;/span&gt;,   &lt;span class=&#34;co&#34;&gt;-- ^ Preserve hard line breaks in the source&lt;/span&gt;
&lt;span class=&#34;ot&#34;&gt;  debug              ::&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Bool&lt;/span&gt; }  &lt;span class=&#34;co&#34;&gt;-- ^ Print container structure for debugging&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There are 2 functions we&#39;ll primarily use: &lt;code&gt;markdown :: Options -&amp;gt; Text -&amp;gt; Doc&lt;/code&gt; parses Markdown, and &lt;code&gt;renderDoc :: Doc -&amp;gt; Html&lt;/code&gt; renders it to HTML. &lt;code&gt;Doc&lt;/code&gt; is a type that consists of &lt;code&gt;Block&lt;/code&gt;s, and blocks usually have &lt;code&gt;Inline&lt;/code&gt;s inside, or other blocks. You can traverse and transform those structures manually, or you can use &lt;code&gt;walk&lt;/code&gt; and friends.&lt;/p&gt;
&lt;h2&gt;&lt;span id=&#34;item-notes-bs2xaisu-rendering-markdown-to-html&#34;&gt;&lt;/span&gt;Rendering Markdown to HTML&lt;/h2&gt;&lt;p&gt;Here&#39;s a program that reads Markdown input, outputs rendered HTML, and doesn&#39;t allow raw HTML. &lt;code&gt;renderHtml&lt;/code&gt; is a function that takes &lt;code&gt;Html&lt;/code&gt; and produces &lt;code&gt;Text&lt;/code&gt; from it, and it comes from &lt;a href=&#34;https://hackage.haskell.org/package/blaze-html&#34;&gt;blaze-html&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;sourceCode&#34;&gt;&lt;pre class=&#34;sourceCode&#34;&gt;&lt;code class=&#34;sourceCode&#34;&gt;&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Cheapskate&lt;/span&gt;
&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Cheapskate.Html&lt;/span&gt;

&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Text.Blaze.Html&lt;/span&gt; (&lt;span class=&#34;dt&#34;&gt;Html&lt;/span&gt;)
&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Text.Blaze.Html.Renderer.Text&lt;/span&gt; (renderHtml)

&lt;span class=&#34;kw&#34;&gt;import qualified&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Data.Text.Lazy&lt;/span&gt;    &lt;span class=&#34;kw&#34;&gt;as&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;TL&lt;/span&gt;
&lt;span class=&#34;kw&#34;&gt;import qualified&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Data.Text.Lazy.IO&lt;/span&gt; &lt;span class=&#34;kw&#34;&gt;as&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;TL&lt;/span&gt;

&lt;span class=&#34;co&#34;&gt;-- Type signatures are added for clarity.&lt;/span&gt;
main &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kw&#34;&gt;do&lt;/span&gt;
  md &lt;span class=&#34;ot&#34;&gt;&amp;lt;-&lt;/span&gt; TL.getContents
  &lt;span class=&#34;kw&#34;&gt;let&lt;/span&gt;&lt;span class=&#34;ot&#34;&gt; parsed ::&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Doc&lt;/span&gt;
      parsed &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; markdown def{allowRawHtml &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;False&lt;/span&gt;} (TL.toStrict md)
  &lt;span class=&#34;kw&#34;&gt;let&lt;/span&gt;&lt;span class=&#34;ot&#34;&gt; rendered ::&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Html&lt;/span&gt;
      rendered &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; renderDoc parsed
  TL.putStr (renderHtml rendered)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you were outputting it to a file, you&#39;d want to use &lt;code&gt;renderHtml&lt;/code&gt; from &lt;code&gt;Text.Blaze.Html.Renderer.Utf8&lt;/code&gt; instead. And if you want pretty indented HTML, use &lt;code&gt;Text.Blaze.Html.Renderer.Pretty&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;span id=&#34;item-notes-bs2xaisu-working-with-parsed-markdown&#34;&gt;&lt;/span&gt;Working with parsed Markdown&lt;/h2&gt;&lt;p&gt;The &lt;a href=&#34;https://hackage.haskell.org/package/cheapskate/docs/Cheapskate-Types.html#t:Inline&#34;&gt;&lt;code&gt;Inline&lt;/code&gt;&lt;/a&gt; and &lt;a href=&#34;https://hackage.haskell.org/package/cheapskate/docs/Cheapskate-Types.html#t:Block&#34;&gt;&lt;code&gt;Block&lt;/code&gt;&lt;/a&gt; types are defined like this:&lt;/p&gt;
&lt;div class=&#34;sourceCode&#34;&gt;&lt;pre class=&#34;sourceCode&#34;&gt;&lt;code class=&#34;sourceCode&#34;&gt;&lt;span class=&#34;kw&#34;&gt;data&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Block&lt;/span&gt; &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Para&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Inlines&lt;/span&gt;
           &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Header&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Int&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Inlines&lt;/span&gt;
           &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Blockquote&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Blocks&lt;/span&gt;
           &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;List&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Bool&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;ListType&lt;/span&gt; [&lt;span class=&#34;dt&#34;&gt;Blocks&lt;/span&gt;]
           &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;CodeBlock&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;CodeAttr&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt;
           &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;HtmlBlock&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt;
           &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;HRule&lt;/span&gt;

&lt;span class=&#34;kw&#34;&gt;data&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Inline&lt;/span&gt; &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Str&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt;
            &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Space&lt;/span&gt;
            &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;SoftBreak&lt;/span&gt;
            &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;LineBreak&lt;/span&gt;
            &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Emph&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Inlines&lt;/span&gt;
            &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Strong&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Inlines&lt;/span&gt;
            &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Code&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt;
            &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Link&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Inlines&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt; &lt;span class=&#34;co&#34;&gt;{- URL -}&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt; &lt;span class=&#34;co&#34;&gt;{- title -}&lt;/span&gt;
            &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Image&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Inlines&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt; &lt;span class=&#34;co&#34;&gt;{- URL -}&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt; &lt;span class=&#34;co&#34;&gt;{- title -}&lt;/span&gt;
            &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Entity&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt;
            &lt;span class=&#34;fu&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;RawHtml&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;Inlines&lt;/code&gt; is defined as &lt;code&gt;Seq Inline&lt;/code&gt;, &lt;code&gt;Blocks&lt;/code&gt; – &lt;code&gt;Seq Block&lt;/code&gt;. You can use &lt;code&gt;for_&lt;/code&gt; or &lt;code&gt;fmap&lt;/code&gt; if you want to traverse them.&lt;/p&gt;
&lt;p&gt;There are two functions for traversing Markdown – &lt;code&gt;walk&lt;/code&gt; and &lt;code&gt;walkM&lt;/code&gt;. The general signature is &lt;code&gt;walk :: (Data a, Data b) =&amp;gt; (a -&amp;gt; a) -&amp;gt; b -&amp;gt; b&lt;/code&gt;, so it can traverse all &lt;code&gt;Inline&lt;/code&gt;s in a &lt;code&gt;Doc&lt;/code&gt;, or all &lt;code&gt;Block&lt;/code&gt;s in a &lt;code&gt;Block&lt;/code&gt;, or any other combination. &lt;code&gt;walkM&lt;/code&gt; is more powerful, as it allows monadic functions – you can use it if your transforming function uses &lt;code&gt;IO&lt;/code&gt;, for instance, or you can do gathering with it. For instance, here&#39;s how to turn some Markdown into plain text, using the &lt;code&gt;Writer&lt;/code&gt; monad:&lt;/p&gt;
&lt;div class=&#34;sourceCode&#34;&gt;&lt;pre class=&#34;sourceCode&#34;&gt;&lt;code class=&#34;sourceCode&#34;&gt;&lt;span class=&#34;co&#34;&gt;-- Using a DList Text instead of Text might be faster&lt;/span&gt;

&lt;span class=&#34;ot&#34;&gt;stringify ::&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Inlines&lt;/span&gt; &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt;
stringify &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; execWriter &lt;span class=&#34;fu&#34;&gt;.&lt;/span&gt; walkM go
  &lt;span class=&#34;kw&#34;&gt;where&lt;/span&gt;
&lt;span class=&#34;ot&#34;&gt;    go ::&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Inline&lt;/span&gt; &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Writer&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Text&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;Inline&lt;/span&gt;
    go i &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kw&#34;&gt;do&lt;/span&gt;
      &lt;span class=&#34;kw&#34;&gt;case&lt;/span&gt; i &lt;span class=&#34;kw&#34;&gt;of&lt;/span&gt;
        &lt;span class=&#34;dt&#34;&gt;Str&lt;/span&gt; x     &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; tell x
        &lt;span class=&#34;dt&#34;&gt;Code&lt;/span&gt; x    &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; tell x
        &lt;span class=&#34;dt&#34;&gt;Space&lt;/span&gt;     &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; tell &lt;span class=&#34;st&#34;&gt;&amp;quot; &amp;quot;&lt;/span&gt;
        &lt;span class=&#34;dt&#34;&gt;SoftBreak&lt;/span&gt; &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; tell &lt;span class=&#34;st&#34;&gt;&amp;quot; &amp;quot;&lt;/span&gt;
        &lt;span class=&#34;dt&#34;&gt;LineBreak&lt;/span&gt; &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; tell &lt;span class=&#34;st&#34;&gt;&amp;quot; &amp;quot;&lt;/span&gt;
        &lt;span class=&#34;co&#34;&gt;-- We should&#39;ve handled the case for Entity as well&lt;/span&gt;
        &lt;span class=&#34;co&#34;&gt;-- (by converting it to a character), but let&#39;s ignore it&lt;/span&gt;
        &lt;span class=&#34;co&#34;&gt;-- for the sake of simplicity.&lt;/span&gt;
        _other    &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; return ()
      return i&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;&lt;span id=&#34;item-notes-bs2xaisu-highlighting-code-blocks&#34;&gt;&lt;/span&gt;Highlighting code blocks&lt;/h2&gt;&lt;p&gt;To highlight code in blocks, use &lt;a href=&#34;https://hackage.haskell.org/package/cheapskate-highlight&#34;&gt;cheapskate-highlight&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&#34;sourceCode&#34;&gt;&lt;pre class=&#34;sourceCode&#34;&gt;&lt;code class=&#34;sourceCode&#34;&gt;&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Cheapskate.Highlight&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the basic case you can just apply &lt;code&gt;highlightDoc&lt;/code&gt; to the parsed &lt;code&gt;Doc&lt;/code&gt; before rendering it. You&#39;d also have to include CSS into your page – you can get the CSS to include by applying &lt;code&gt;styleToCss :: Style -&amp;gt; String&lt;/code&gt; to one of the styles defined in &lt;a href=&#34;https://hackage.haskell.org/package/highlighting-kate/docs/Text-Highlighting-Kate-Styles.html&#34;&gt;&lt;code&gt;Text.Highlighting.Kate.Styles&lt;/code&gt;&lt;/a&gt; (reexported by &lt;code&gt;Cheapskate.Highlight&lt;/code&gt;), for instance &lt;code&gt;pygments&lt;/code&gt;.&lt;/p&gt;
</content><link xmlns:ns="http://www.w3.org/2005/Atom" ns:href="https://guide.aelve.com/haskell/markdown-hm7miz9n#item-bs2xaisu"/></entry><entry><id>azu32pdx</id><title xmlns:ns="http://www.w3.org/2005/Atom" ns:type="text">pandoc</title><updated>2016-04-11T20:54:57Z</updated><content xmlns:ns="http://www.w3.org/2005/Atom" ns:type="html">&lt;h1&gt;  &lt;a href=&#34;http://pandoc.org/&#34; class=&#34;item-name&#34;&gt;pandoc&lt;/a&gt;

  
  (&lt;a href=&#34;https://hackage.haskell.org/package/pandoc&#34;&gt;Hackage&lt;/a&gt;)
&lt;/h1&gt;&lt;p&gt;A document converter that supports about 15 input formats (including Markdown). Has the most feature-rich Markdown dialect and can convert to the most number of formats. Not recommended for web (when Markdown is written by users and not by you), but very good for blogs, articles, slides/presentations, generating documentation, and so on.&lt;/p&gt;
&lt;h2&gt;Pros&lt;/h2&gt;&lt;ul&gt;&lt;p&gt;&lt;li&gt;Can convert to the most number of formats (including EPUB, docx, ODT, LaTeX, and other markup formats like Haddock, DocBook, MediaWiki markup, etc).&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Has the most number of features – superscript/subscript/strikethrough, footnotes, tables, definition lists, math rendering, citations, code highlighting, table of contents generation, and so on.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;The implementation doesn&#39;t use advanced Haskell features and can easily be modified (if you want to add features to your dialect of Markdown).&lt;/li&gt;&lt;/p&gt;&lt;/ul&gt;&lt;h2&gt;Cons&lt;/h2&gt;&lt;ul&gt;&lt;p&gt;&lt;li&gt;Quite heavy if the only thing you want is rendering Markdown to HTML.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Doesn&#39;t handle pathological inputs well (e.g. parsing &lt;code&gt;[[[[[[[[[[[[[[[[[ foo ]]]]]]]]]]]]]]]]]&lt;/code&gt; takes 40s on my machine).&lt;/li&gt;&lt;/p&gt;&lt;/ul&gt;&lt;h2&gt;Ecosystem&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;http://scholdoc.scholarlymarkdown.com/&#34;&gt;Scholdoc&lt;/a&gt; – a fork of Pandoc for academic writing&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Filters: &lt;a href=&#34;https://hackage.haskell.org/package/pandoc-include&#34;&gt;pandoc-include&lt;/a&gt; (for including contents of referenced files), &lt;a href=&#34;https://hackage.haskell.org/package/pandoc-csv2table&#34;&gt;pandoc-csv2table&lt;/a&gt; (for rendering CSV tables), &lt;a href=&#34;https://hackage.haskell.org/package/pandoc-crossref&#34;&gt;pandoc-crossref&lt;/a&gt; (for numbering figures/tables and cross-referencing), &lt;a href=&#34;https://hackage.haskell.org/package/pandoc-citeproc&#34;&gt;pandoc-citeproc&lt;/a&gt;. A bigger list is &lt;a href=&#34;https://github.com/jgm/pandoc/wiki/Pandoc-Extras#filters&#34;&gt;on the Pandoc wiki&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Notes&lt;/h2&gt;&lt;h1&gt;&lt;span id=&#34;item-notes-azu32pdx-links&#34;&gt;&lt;/span&gt;Links&lt;/h1&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://pandoc.org/README.html&#34;&gt;user guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://pandoc.org/try/&#34;&gt;try online&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;&lt;span id=&#34;item-notes-azu32pdx-imports&#34;&gt;&lt;/span&gt;Imports&lt;/h1&gt;&lt;div class=&#34;sourceCode&#34;&gt;&lt;pre class=&#34;sourceCode&#34;&gt;&lt;code class=&#34;sourceCode&#34;&gt;&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Text.Pandoc&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;&lt;span id=&#34;item-notes-azu32pdx-usage&#34;&gt;&lt;/span&gt;Usage&lt;/h1&gt;&lt;h2&gt;&lt;span id=&#34;item-notes-azu32pdx-markdown-to-html&#34;&gt;&lt;/span&gt;Markdown to HTML&lt;/h2&gt;&lt;p&gt;Here&#39;s a program that reads Markdown input and outputs rendered HTML:&lt;/p&gt;
&lt;div class=&#34;sourceCode&#34;&gt;&lt;pre class=&#34;sourceCode&#34;&gt;&lt;code class=&#34;sourceCode&#34;&gt;&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Text.Pandoc&lt;/span&gt;

main &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kw&#34;&gt;do&lt;/span&gt;
  s &lt;span class=&#34;ot&#34;&gt;&amp;lt;-&lt;/span&gt; getContents
  parsed &lt;span class=&#34;ot&#34;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&#34;kw&#34;&gt;case&lt;/span&gt; readMarkdown def s &lt;span class=&#34;kw&#34;&gt;of&lt;/span&gt;
    &lt;span class=&#34;dt&#34;&gt;Left&lt;/span&gt;  err &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; error (show err)
    &lt;span class=&#34;dt&#34;&gt;Right&lt;/span&gt; doc &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; return doc
  putStrLn (writeHtmlString def parsed)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We might also generate a full HTML document instead of simply some markup. To do that, we&#39;ll use &lt;code&gt;writerStandalone = True&lt;/code&gt; and &lt;a href=&#34;http://stackoverflow.com/questions/17223424/customising-pandocs-html-output-with-css-or-a-template&#34;&gt;load a template&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&#34;sourceCode&#34;&gt;&lt;pre class=&#34;sourceCode&#34;&gt;&lt;code class=&#34;sourceCode&#34;&gt;&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;Text.Pandoc&lt;/span&gt;

main &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kw&#34;&gt;do&lt;/span&gt;
  s &lt;span class=&#34;ot&#34;&gt;&amp;lt;-&lt;/span&gt; getContents
  template &lt;span class=&#34;ot&#34;&gt;&amp;lt;-&lt;/span&gt; either (error &lt;span class=&#34;fu&#34;&gt;.&lt;/span&gt; show) id &lt;span class=&#34;fu&#34;&gt;&amp;lt;$&amp;gt;&lt;/span&gt;
                getDefaultTemplate &lt;span class=&#34;dt&#34;&gt;Nothing&lt;/span&gt; &lt;span class=&#34;st&#34;&gt;&amp;quot;html&amp;quot;&lt;/span&gt;
  parsed &lt;span class=&#34;ot&#34;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&#34;kw&#34;&gt;case&lt;/span&gt; readMarkdown def s &lt;span class=&#34;kw&#34;&gt;of&lt;/span&gt;
    &lt;span class=&#34;dt&#34;&gt;Left&lt;/span&gt;  err &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; error (show err)
    &lt;span class=&#34;dt&#34;&gt;Right&lt;/span&gt; doc &lt;span class=&#34;ot&#34;&gt;-&amp;gt;&lt;/span&gt; return doc
  &lt;span class=&#34;kw&#34;&gt;let&lt;/span&gt; writerOpts &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; def {
        writerStandalone &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;dt&#34;&gt;True&lt;/span&gt;,
        writerTemplate   &lt;span class=&#34;fu&#34;&gt;=&lt;/span&gt; template }
  putStr (writeHtmlString writerOpts parsed)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;&lt;span id=&#34;item-notes-azu32pdx-working-with-parsed-markdown&#34;&gt;&lt;/span&gt;Working with parsed Markdown&lt;/h2&gt;&lt;p&gt;For transforming Markdown, use functions from &lt;a href=&#34;https://hackage.haskell.org/package/pandoc-types/docs/Text-Pandoc-Walk.html&#34;&gt;&lt;code&gt;Text.Pandoc.Walk&lt;/code&gt;&lt;/a&gt; (from &lt;a href=&#34;https://hackage.haskell.org/package/pandoc-types&#34;&gt;pandoc-types&lt;/a&gt;). There are some examples available in the docs.&lt;/p&gt;
&lt;p&gt;You can construct your own documents by using functions from &lt;a href=&#34;https://hackage.haskell.org/package/pandoc-types/docs/Text-Pandoc-Builder.html&#34;&gt;&lt;code&gt;Text.Pandoc.Builder&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There are some helper functions (such as &lt;code&gt;stringify&lt;/code&gt; or &lt;code&gt;capitalize&lt;/code&gt;) in &lt;a href=&#34;https://hackage.haskell.org/package/pandoc/docs/Text-Pandoc-Shared.html&#34;&gt;&lt;code&gt;Text.Pandoc.Shared&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
</content><link xmlns:ns="http://www.w3.org/2005/Atom" ns:href="https://guide.aelve.com/haskell/markdown-hm7miz9n#item-azu32pdx"/></entry><entry><id>od8l021u</id><title xmlns:ns="http://www.w3.org/2005/Atom" ns:type="text">cmark</title><updated>2016-04-11T20:54:55Z</updated><content xmlns:ns="http://www.w3.org/2005/Atom" ns:type="html">&lt;h1&gt;  &lt;a href=&#34;https://github.com/jgm/cmark&#34; class=&#34;item-name&#34;&gt;cmark&lt;/a&gt;

  
  (&lt;a href=&#34;https://hackage.haskell.org/package/cmark&#34;&gt;Hackage&lt;/a&gt;)
&lt;/h1&gt;&lt;p&gt;A lightweight Markdown library from the author of Pandoc, implementing the &lt;a href=&#34;http://commonmark.org/&#34;&gt;CommonMark&lt;/a&gt; standard (which is just a more precisely specified version of Markdown). Can parse Markdown and convert it to various formats (including HTML).&lt;/p&gt;
&lt;p&gt;Binds to a C library (&lt;a href=&#34;https://github.com/jgm/cmark&#34;&gt;libcmark&lt;/a&gt;), but doesn&#39;t require it to be installed – the sources are shipped with the Haskell package.&lt;/p&gt;
&lt;h2&gt;Pros&lt;/h2&gt;&lt;ul&gt;&lt;p&gt;&lt;li&gt;Very fast (the author&#39;s benchmarks: 82× faster than &lt;a href=&#34;https://hackage.haskell.org/package/cheapskate&#34;&gt;cheapskate&lt;/a&gt;, 59× faster than &lt;a href=&#34;https://hackage.haskell.org/package/markdown&#34;&gt;markdown&lt;/a&gt;, 105× faster than &lt;a href=&#34;https://hackage.haskell.org/package/pandoc&#34;&gt;pandoc&lt;/a&gt;, 3× faster than &lt;a href=&#34;https://hackage.haskell.org/package/discount&#34;&gt;discount&lt;/a&gt;).&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Can deal with any input, including garbage, with linear performance. (Some Markdown parsers have quadratic complexity on some inputs, which gives an attacker an opportunity to slow down your site.)&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Can render to several formats: apart from HTML, it also supports LaTeX, groff man, and a custom XML format.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;The only library here that lets you get position info for parsed blocks.&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Has a &lt;a href=&#34;http://github.com/jgm/commonmark.js&#34;&gt;sibling Javascript library&lt;/a&gt; that implements the same specification (so that the results of client-side and server-side rendering would fully match).&lt;/li&gt;&lt;/p&gt;&lt;/ul&gt;&lt;h2&gt;Cons&lt;/h2&gt;&lt;ul&gt;&lt;p&gt;&lt;li&gt;Can&#39;t automatically recognise links (i.e. if you write &lt;code&gt;go to https://google.com&lt;/code&gt;, the link won&#39;t be highlighted).&lt;/li&gt;&lt;/p&gt;&lt;p&gt;&lt;li&gt;Doesn&#39;t sanitize HTML output by default (you have to use &lt;a href=&#34;https://hackage.haskell.org/package/xss-sanitize&#34;&gt;xss-sanitize&lt;/a&gt; if you want that).&lt;/li&gt;&lt;/p&gt;&lt;/ul&gt;&lt;h2&gt;Ecosystem&lt;/h2&gt;&lt;p&gt;&lt;a href=&#34;https://hackage.haskell.org/package/cmark-highlight&#34;&gt;cmark-highlight&lt;/a&gt; (highlights code blocks)&lt;/p&gt;
&lt;h2&gt;Notes&lt;/h2&gt;&lt;h1&gt;&lt;span id=&#34;item-notes-od8l021u-links&#34;&gt;&lt;/span&gt;Links&lt;/h1&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://commonmark.org/&#34;&gt;site of Commonmark&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://spec.commonmark.org/&#34;&gt;specification of Commonmark&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;&lt;span id=&#34;item-notes-od8l021u-imports&#34;&gt;&lt;/span&gt;Imports&lt;/h1&gt;&lt;div class=&#34;sourceCode&#34;&gt;&lt;pre class=&#34;sourceCode&#34;&gt;&lt;code class=&#34;sourceCode&#34;&gt;&lt;span class=&#34;kw&#34;&gt;import &lt;/span&gt;&lt;span class=&#34;dt&#34;&gt;CMark&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;&lt;span id=&#34;item-notes-od8l021u-usage&#34;&gt;&lt;/span&gt;Usage&lt;/h1&gt;&lt;p&gt;In the simplest case you just use &lt;code&gt;commonmarkToHtml&lt;/code&gt; (or &lt;code&gt;commonmarkToLaTeX&lt;/code&gt;, etc) which takes text, parses it, and renders it. You can also parse Markdown with &lt;code&gt;commonmarkToNode&lt;/code&gt;, transform it, and then render with &lt;code&gt;nodeToHtml&lt;/code&gt;.&lt;/p&gt;
</content><link xmlns:ns="http://www.w3.org/2005/Atom" ns:href="https://guide.aelve.com/haskell/markdown-hm7miz9n#item-od8l021u"/></entry></feed>