gitit icon indicating copy to clipboard operation
gitit copied to clipboard

How to use `markdown_strict` in gitit?

Open Edenharder opened this issue 9 years ago • 6 comments

I do not want to use all the features of Pandoc style markdown, because the following html code will be interpreted:

<iframe frameborder=“no” border=“0” marginwidth=“0” marginheight=“0” width=298 height=52 src=“http://music.163.com/outchain/player?type=2&id=http://music.163.com/#/song?id=5285415&auto=0&height=32”>

As I test, the above html code will not be interpreted if markdown_strict is used. So the question is how to use markdown_strict in gitit?

Edenharder avatar Dec 07 '15 15:12 Edenharder

The problem is not that you're not using markdown_strict. The problem is that the HTML is invalid, which is why pandoc is not passing it through.

For one thing, you have curly quotes rather than straight quotes around the attributes. Another problem is the unescaped ampersands (&) in the URL. In HTML all ampersands must be escaped as &amp;, even in this context.

+++ Edenharder [Dec 07 15 07:00 ]:

I do not want to use all the features of Pandoc style markdown, because the following html code will be interpreted:

jgm avatar Dec 07 '15 17:12 jgm

I also use pandoc to transfer some markdown files. If I use markdown_strict:

pandoc -f markdown_strict+footnotes+tex_math_dollars test.md -o  test.html

then

<p><iframe frameborder=“no” border=“0” marginwidth=“0” marginheight=“0” width=298 height=52 src=“http://music.163.com/outchain/player?type=2&id=http://music.163.com/#/song?id=5285415&auto=0&height=32”></p>

will not be interpreted. Everything seems okay.

Edenharder avatar Dec 07 '15 23:12 Edenharder

I know "the HTML is invalid", but it is out of my control. If I change it, it will not work. What's in my control is how to interpret it, and the only method I find is to use markdown_strict.

Edenharder avatar Dec 09 '15 01:12 Edenharder

My point is that markdown_strict won't work either.

Newer versions of pandoc are pickier about what they pass through as raw HTML -- with or without strict.

+++ Edenharder [Dec 08 15 17:54 ]:

I know "the HTML is invalid", but it is out of my control. If I change it, it will not work. What's in my control is how to interpret it, and the only method I find is to use markdown_strict.

— Reply to this email directly or [1]view it on GitHub.

References

  1. https://github.com/jgm/gitit/issues/523#issuecomment-163081303

jgm avatar Dec 09 '15 17:12 jgm

Thanks! Even though, I still want to know how to use markdown_strict. Maybe some other cases push me to not use all the features of pandoc style markdown.

Edenharder avatar Dec 10 '15 00:12 Edenharder

I've recently stumbled upon a reason that makes me really want to make gitit use markdown_strict as input format. I needed some facy tables in my wiki that were not possible to create in markdown. Hence I wrote them in HTML. The annoying thing is, that markdown as a format won't let me nicely indent my HTML code. So instead of writing

<table>
    <tr>
        <td></td>
    </tr>
</table>

(which results in a code block rather than a table) I have to use

<table>
<tr>
<td></td>
</tr>
</table>

which, in case of complex (and especially nested), tables is a huge mess and no fun to edit.

The way I understand it is that markdown_strict does not look for markdown inbetween <table> and </table> and everything is just fine, whereas markdown finds 4 spaces right after <table> and creates a code block.

It would therefore be really nice to, for example, be able to specify format: mardown_strict in a page's metadata block or, even better, be able to set the markdown format default to strict in a wiki's config.

IllDepence avatar Jan 12 '16 06:01 IllDepence