gitit icon indicating copy to clipboard operation
gitit copied to clipboard

Github Flavoured Markdown

Open 0xdevalias opened this issue 8 years ago • 5 comments

It would be great to be able to use GitHub Flavoured Markdown.

Looking at the Pandoc options you can use markdown_github, but trying to use this in my config file gives me an error:

gitit: Unknown page type: markdown_github

Searching the code, it seems this happens in Utils.hs, but I don't know enough (read: any) Haskell to figure out where to go from here, and how to go about adding support.

0xdevalias avatar Nov 04 '16 03:11 0xdevalias

Not only GitHub MD Pandoc can be configured to use all sorts of MD syntax through extensions as stated here http://pandoc.org/MANUAL.html#pandocs-markdown. It would be great if Gitit could be configured to transfer those options to Pandoc.

I'm thinking globally in config file and per page in metadata block.

How about that?

meridius avatar Nov 04 '16 11:11 meridius

That would be an even better solution :) Avoid all the arbitrary limitations!

Get Outlook for iOS

On Fri, Nov 4, 2016 at 10:46 PM +1100, "Martin Lukeš" [email protected] wrote:

Not only GitHub MD Pandoc can be configured to use all sorts of MD syntax through extensions as stated here http://pandoc.org/MANUAL.html#pandocs-markdown. It would be great if Gitit could be configured to transfer those options to Pandoc.

I'm thinking globally in config file and per page in metadata block.

How about that?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

0xdevalias avatar Nov 04 '16 12:11 0xdevalias

Is it possible to implement this support? I need this too.

hying-caritas avatar Apr 06 '17 06:04 hying-caritas

I don't know enough Haskell to implement a general solution, but I found that changing these lines in ContentTransformer.hs was enough to get gitit to use GFM.

Before change:

readerExtensions = if lhs
                      then Set.insert Ext_literate_haskell
                           $ readerExtensions def
                      else readerExtensions def

After change:

readerExtensions = if lhs
                      then Set.insert Ext_literate_haskell
                           $ githubMarkdownExtensions
                      else githubMarkdownExtensions

You could also pick your own specific extensions from Text.Pandoc.Options. For example to use pandoc markdown with the extenstion hard_line_breaks:

readerExtensions = if lhs
                      then Set.insert Ext_literate_haskell
                           $ Set.insert Ext_hard_line_breaks
                           $ readerExtensions def
                      else Set.insert Ext_hard_line_breaks
                           $ readerExtensions def

ernstwi avatar Sep 10 '17 13:09 ernstwi

Any update on this?

fzumstein avatar Jul 09 '18 16:07 fzumstein