codekingpro/portable-devtools
114k
1__all__ = ("commonmark", "default", "gfm_like", "gfm_like2", "js_default", "zero")2 3from ..utils import PresetType4from . import commonmark, default, zero5 6js_default = default7 8 9class gfm_like: # noqa: N80110 """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 specification16 (see https://github.github.com/gfm/#autolinks-extension-).17 """18 19 @staticmethod20 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"] = True27 config["options"]["html"] = True28 return config29 30 31class gfm_like2: # noqa: N80132 """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 @staticmethod42 def make() -> PresetType:43 config = gfm_like.make()44 config["options"]["tasklists"] = True45 config["options"]["tasklists_editable"] = False46 config["options"]["alerts"] = True47 config["options"]["strikethrough_single_tilde"] = True48 return config49 