jgm / gitit

A wiki using HAppS, pandoc, and git
GNU General Public License v2.0
2.15k stars 226 forks source link

Github Flavoured Markdown #580

Open 0xdevalias opened 7 years ago

0xdevalias commented 7 years ago

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.

meridius commented 7 years ago

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?

0xdevalias commented 7 years ago

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š" notifications@github.com 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.

hying-caritas commented 7 years ago

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

ernstwi commented 7 years ago

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
fzumstein commented 6 years ago

Any update on this?