1"""Commonmark default options.
2
3This differs to presets.default,
4primarily in that it allows HTML and does not enable components:
5
6- block: table
7- inline: strikethrough
8"""
9
10from ..utils import PresetType
11
12
13def make() -> PresetType:
14 return {
15 "options": {
16 "maxNesting": 20, # Internal protection, recursion limit
17 "html": True, # Enable HTML tags in source,
18 # this is just a shorthand for .enable(["html_inline", "html_block"])
19 # used by the linkify rule:
20 "linkify": False, # autoconvert URL-like texts to links
21 # used by the replacements and smartquotes rules
22 # Enable some language-neutral replacements + quotes beautification
23 "typographer": False,
24 # used by the smartquotes rule:
25 # Double + single quotes replacement pairs, when typographer enabled,
26 # and smartquotes on. Could be either a String or an Array.
27 #
28 # For example, you can use '«»„“' for Russian, '„“‚‘' for German,
29 # and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
30 "quotes": "\u201c\u201d\u2018\u2019", # /* “”‘’ */
31 # Renderer specific; these options are used directly in the HTML renderer
32 "xhtmlOut": True, # Use '/' to close single tags (<br />)
33 "breaks": False, # Convert '\n' in paragraphs into <br>
34 "langPrefix": "language-", # CSS language prefix for fenced blocks
35 # Highlighter function. Should return escaped HTML,
36 # or '' if the source string is not changed and should be escaped externally.
37 # If result starts with <pre... internal wrapper is skipped.
38 #
39 # function (/*str, lang, attrs*/) { return ''; }
40 #
41 "highlight": None,
42 },
43 "components": {
44 "core": {"rules": ["normalize", "block", "inline", "text_join"]},
45 "block": {
46 "rules": [
47 "blockquote",
48 "code",
49 "fence",
50 "heading",
51 "hr",
52 "html_block",
53 "lheading",
54 "list",
55 "reference",
56 "paragraph",
57 ]
58 },
59 "inline": {
60 "rules": [
61 "autolink",
62 "backticks",
63 "emphasis",
64 "entity",
65 "escape",
66 "html_inline",
67 "image",
68 "link",
69 "newline",
70 "text",
71 ],
72 "rules2": ["balance_pairs", "emphasis", "fragments_join"],
73 },
74 },
75 }