MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / body_to_html

Function body_to_html

scripts/website/blog_text.py:82–97  ·  view source on GitHub ↗

Render a post's Markdown to HTML for grammar checks. Strips YAML front matter defensively (so callers may pass either the body or the whole file — front matter must never reach the prose checkers) and Hugo shortcodes, then renders. Imports python-markdown lazily so the dependency-fr

(body)

Source from the content-addressed store, hash-verified

80
81
82def body_to_html(body):
83 """Render a post's Markdown to HTML for grammar checks.
84
85 Strips YAML front matter defensively (so callers may pass either the body or
86 the whole file — front matter must never reach the prose checkers) and Hugo
87 shortcodes, then renders. Imports python-markdown lazily so the
88 dependency-free paragraph check does not require it. fenced_code/tables
89 produce <pre><code> and <table> markup that run_languagetool.py skips.
90 """
91 import markdown # lazy: only render paths need it
92
93 _fm, body, _start = split_front_matter(body)
94 return markdown.markdown(
95 strip_shortcodes(author_body(body)),
96 extensions=["fenced_code", "tables"],
97 )

Callers 1

renderFunction · 0.90

Calls 3

split_front_matterFunction · 0.85
strip_shortcodesFunction · 0.85
author_bodyFunction · 0.85

Tested by

no test coverage detected