Skip to content

More markdown settings #66

Merged
merged 4 commits into from
Feb 5, 2020
Merged

More markdown settings #66

merged 4 commits into from
Feb 5, 2020

Conversation

donald
Copy link
Member

@donald donald commented Feb 5, 2020

No description provided.

It appears that for random text the MIME lexer wins:

    In [4]: import pygments.lexer
    In [5]: pygments.lexers.guess_lexer("Hallo")
    Out[5]: <pygments.lexers.MIMELexer>

which usually generates errors for random text:

    In [11]: from markdown.extensions.codehilite import CodeHilite
    In [12]: CodeHilite(src = 'Hallo').hilite()
    Out[12]: '<div class="codehilite"><pre><span></span><span class="err">Hallo</span>\n</pre></div>\n'

which just look ugly (red border on each line).

So switch off language guessing. In that case, code blocks without a
explicit language are left as is:

    In [13]: CodeHilite(src = 'Hallo',guess_lang=False).hilite()
    Out[13]: '<div class="codehilite"><pre><span></span>Hallo\n</pre></div>\n'

In Markdown, the language should be set explicitly, for language
specific highlighting.

    :::python
    print("Hallo")
The bulma style sets margin-bottom to 1em for several block-level
elements (eg <p>). However the codehilite <div>s, generated by the
codehilite Markdown extension don't have that. So we have 1em vertical
space before a code block but not after, which just looks wrong.

Add vertical space after codehilite <div>s.
Add Admonition extension which allows to add class attributes and a
title to a block. So

    !!!alert "Red Alert"
        Warp core breach

becomes

    <div class="admonition alert">
      <p class="admonition-title">Red Alert</p>
      <p>Warp core breach</p>
    </div>
Add inline style to wagtailadmin/pages/edit.html to force the markdown
textarea to monospaced font.
@donald donald merged commit 65d698e into master Feb 5, 2020
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant