pandoc icon indicating copy to clipboard operation
pandoc copied to clipboard

Kramdown reader?

Open c-forster opened this issue 9 years ago • 10 comments
trafficstars

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?

c-forster avatar Feb 13 '16 22:02 c-forster

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

mb21 avatar Feb 14 '16 18:02 mb21

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.

dato avatar Oct 28 '16 15:10 dato

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).

ousia avatar Oct 28 '16 17:10 ousia

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.

jgm avatar Oct 28 '16 17:10 jgm

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):

  • write Markdown including {:toc}—and publish it to GitHub Pages (which uses Kramdown)
  • process the same Markdown file with pandoc into pdf ({:toc} gets converted as text)

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.

dato avatar Oct 28 '16 18:10 dato

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?

ickc avatar Nov 11 '16 03:11 ickc

+++ 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...

jgm avatar Nov 12 '16 00:11 jgm

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

xplosionmind avatar Nov 12 '20 18:11 xplosionmind

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}

simonv3 avatar Jan 17 '22 02:01 simonv3

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.

asmaier avatar May 31 '22 21:05 asmaier