Show More
@@ -20,7 +20,55 b'' | |||
|
20 | 20 | |
|
21 | 21 | import markdown |
|
22 | 22 | |
|
23 | from mdx_gfm import GithubFlavoredMarkdownExtension # pragma: no cover | |
|
23 | from markdown.extensions import Extension | |
|
24 | from markdown.extensions.fenced_code import FencedCodeExtension | |
|
25 | from markdown.extensions.smart_strong import SmartEmphasisExtension | |
|
26 | from markdown.extensions.tables import TableExtension | |
|
27 | from markdown.extensions.nl2br import Nl2BrExtension | |
|
28 | ||
|
29 | import gfm | |
|
30 | ||
|
31 | ||
|
32 | class GithubFlavoredMarkdownExtension(Extension): | |
|
33 | """ | |
|
34 | An extension that is as compatible as possible with GitHub-flavored | |
|
35 | Markdown (GFM). | |
|
36 | ||
|
37 | This extension aims to be compatible with the variant of GFM that GitHub | |
|
38 | uses for Markdown-formatted gists and files (including READMEs). This | |
|
39 | variant seems to have all the extensions described in the `GFM | |
|
40 | documentation`_, except: | |
|
41 | ||
|
42 | - Newlines in paragraphs are not transformed into ``br`` tags. | |
|
43 | - Intra-GitHub links to commits, repositories, and issues are not | |
|
44 | supported. | |
|
45 | ||
|
46 | If you need support for features specific to GitHub comments and issues, | |
|
47 | please use :class:`mdx_gfm.GithubFlavoredMarkdownExtension`. | |
|
48 | ||
|
49 | .. _GFM documentation: https://guides.github.com/features/mastering-markdown/ | |
|
50 | """ | |
|
51 | ||
|
52 | def extendMarkdown(self, md, md_globals): | |
|
53 | # Built-in extensions | |
|
54 | FencedCodeExtension().extendMarkdown(md, md_globals) | |
|
55 | SmartEmphasisExtension().extendMarkdown(md, md_globals) | |
|
56 | TableExtension().extendMarkdown(md, md_globals) | |
|
57 | ||
|
58 | # Custom extensions | |
|
59 | gfm.AutolinkExtension().extendMarkdown(md, md_globals) | |
|
60 | gfm.AutomailExtension().extendMarkdown(md, md_globals) | |
|
61 | gfm.HiddenHiliteExtension([ | |
|
62 | ('guess_lang', 'False'), | |
|
63 | ('css_class', 'highlight') | |
|
64 | ]).extendMarkdown(md, md_globals) | |
|
65 | gfm.SemiSaneListExtension().extendMarkdown(md, md_globals) | |
|
66 | gfm.SpacedLinkExtension().extendMarkdown(md, md_globals) | |
|
67 | gfm.StrikethroughExtension().extendMarkdown(md, md_globals) | |
|
68 | gfm.TaskListExtension([ | |
|
69 | ('list_attrs', {'class': 'checkbox'}) | |
|
70 | ]).extendMarkdown(md, md_globals) | |
|
71 | Nl2BrExtension().extendMarkdown(md, md_globals) | |
|
24 | 72 | |
|
25 | 73 | |
|
26 | 74 | # Global Vars |
@@ -212,6 +212,13 b' div.markdown-block strong {' | |||
|
212 | 212 | margin: 0; |
|
213 | 213 | } |
|
214 | 214 | |
|
215 | div.markdown-block ul.checkbox, | |
|
216 | div.markdown-block ol.checkbox { | |
|
217 | padding-left: 20px !important; | |
|
218 | margin-top: 0px !important; | |
|
219 | margin-bottom: 18px !important; | |
|
220 | } | |
|
221 | ||
|
215 | 222 | div.markdown-block ul, |
|
216 | 223 | div.markdown-block ol { |
|
217 | 224 | padding-left: 30px !important; |
@@ -219,6 +226,13 b' div.markdown-block ol {' | |||
|
219 | 226 | margin-bottom: 18px !important; |
|
220 | 227 | } |
|
221 | 228 | |
|
229 | div.markdown-block ul.checkbox li, | |
|
230 | div.markdown-block ol.checkbox li { | |
|
231 | list-style: none !important; | |
|
232 | margin: 6px !important; | |
|
233 | padding: 0 !important; | |
|
234 | } | |
|
235 | ||
|
222 | 236 | div.markdown-block ul li, |
|
223 | 237 | div.markdown-block ol li { |
|
224 | 238 | list-style: disc !important; |
General Comments 0
You need to be logged in to leave comments.
Login now