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