jgm / pandoc

Universal markup converter
https://pandoc.org
Other
33.69k stars 3.33k forks source link

Kramdown reader? #2711

Open c-forster opened 8 years ago

c-forster commented 8 years ago

Has anyone considered, or started work on, a kramdown reader? Would it be best to implement such a reader as a separate reader or as an extension to the existing Markdown reader?

mb21 commented 8 years ago

Wouldn't it be possible to specify a markdown_kramdown-variant? A variant is simply a set of pandoc markdown extensions that are turned on or off, see http://pandoc.org/README.html#markdown-variants

dato commented 7 years ago

One thing I wouldn’t know how to solve is Kramdown’s support for automatic table of contents generation.

Pandoc has --toc, but it inserts the table of contents in a fixed location.

AFAIK, Kramdown’s {:toc} can be specified at any point of the document.

ousia commented 7 years ago

AFAIK, Kramdown’s {:toc} can be specified at any point of the document.

@dato, we discussed that for {#toc} in Markdown, but it hasn’t been implemented (yet).

It has been implemented for {#references} (I haven’t tested it).

jgm commented 7 years ago

You can reposition the $toc$ in the template. So it can come before or after the body, and you could also have it come after the abstract, for example, or after some fixed introductory text. The only thing you can't do this way is put it inside the middle of the document body.

dato commented 7 years ago

Right, I know. That’s fine, and not too big of a limitation. (And LaTeX export supports \tableofcontents directly anyway—which is nice).

However, I thought I’d mention {:toc} here, since this is an issue about reading Kramdown-flavoured markdown.

For example, the following doesn’t really work at the moment (or I haven’t managed to make it work):

Now that I think of it: is there a way I could make pandoc ignore lines like {:toc} and {:.no_toc} in, say, LaTeX export (or HTML)?

Many thanks for your replies.

ickc commented 7 years ago

I'm working on some kind of markdown-variants-cheatsheets in ickc/markdown-variants, part of what needed to be done is tabulate the extensions supported by different variants of markdown. And Kramdown is part of my list. I might be able to add a markdown variant of kramdown in pandoc, similar to what markdown_mmd or markdown_github currently does. i.e. not adding new syntaxes, but to essentially make a shortcut to a combinations of markdown_strict+...+.... Will that be useful?

jgm commented 7 years ago

+++ ickc [Nov 10 16 19:43 ]:

I'm working on some kind of markdown-variants-cheatsheets in [1]ickc/markdown-variants, part of what needed to be done is tabulate the extensions supported by different variants of markdown. And Kramdown is part of my list. I might be able to add a markdown variant of kramdown in pandoc, similar to what markdown_mmd or markdown_github currently does. i.e. not adding new syntaxes, but to essentially make a shortcut to a combinations of markdown_strict+...+.... Will that be useful?

Only if these extensions capture most of what kramdown has. If there's too much missing, then it will just be misleading and make people submit bug reports...

xplosionmind commented 3 years ago

Hello, any news? I'd love to add Pandoc compatibility with my Jekyll website

simonv3 commented 2 years ago

I think the main thing I've noticed missing is kramdown's element attributes are written differently from what's in the standard markdown, and that might be "easy" to add as an extension?

kramdown: {:class="class-name"}

pandoc: {.class-name}

asmaier commented 2 years ago

Kramdown also uses a different way to define math section compared to other markdown variants. It uses $$ delimiter for both inline and display math. But display math sections must be separated from the rest of the text by blank lines.

Inline Math: text $$ E = mc^2 $$ text converted by kramdown into text \( E = mc^2 \) text in the HTML Display Math:

text

$$\begin{aligned}
E = mc^2
\end{aligned}$$

text

converted by kramdown into

text

\[\begin{aligned}
E = mc^2
\end{aligned}\]

text

in the HTML. I don't think pandoc can handle the same delimiter $$ for both inline and display math at the moment.