1__all__ = ("commonmark", "default", "gfm_like", "gfm_like2", "js_default", "zero")
2
3from ..utils import PresetType
4from . import commonmark, default, zero
5
6js_default = default
7
8
9class gfm_like: # noqa: N801
10 """GitHub Flavoured Markdown (GFM) like.
11
12 This adds the linkify, table and strikethrough components to CommmonMark.
13
14 Note, it lacks task-list items and raw HTML filtering,
15 to meet the the full GFM specification
16 (see https://github.github.com/gfm/#autolinks-extension-).
17 """
18
19 @staticmethod
20 def make() -> PresetType:
21 config = commonmark.make()
22 config["components"]["core"]["rules"].append("linkify")
23 config["components"]["block"]["rules"].append("table")
24 config["components"]["inline"]["rules"].extend(["strikethrough", "linkify"])
25 config["components"]["inline"]["rules2"].append("strikethrough")
26 config["options"]["linkify"] = True
27 config["options"]["html"] = True
28 return config
29
30
31class gfm_like2: # noqa: N801
32 """GitHub Flavoured Markdown (GFM) like, extended.
33
34 Builds on ``gfm-like`` and additionally enables:
35
36 - Task lists (``- [x] done``)
37 - Alerts (``> [!NOTE]``)
38 - Single-tilde strikethrough (``~text~`` in addition to ``~~text~~``)
39 """
40
41 @staticmethod
42 def make() -> PresetType:
43 config = gfm_like.make()
44 config["options"]["tasklists"] = True
45 config["options"]["tasklists_editable"] = False
46 config["options"]["alerts"] = True
47 config["options"]["strikethrough_single_tilde"] = True
48 return config