Hwaro::Content::Processors::Markdown
Inherits Hwaro::Content::Processors::Base / Reference / Object
Markdown processor implementation
Constants
Regex for matching h1-h6 tags with IDs to insert anchor links.
Attribute scans here and below are quote-aware (a > inside a
quoted value, e.g. title="a > b", is legal HTML5 and must not end
the tag) and the id key uses a (?<![\w-]) guard so data-id=
never counts as the element's id.
Regex for post_process_html — lightweight replacements for XML.parse_html Matches
…
through…
, capturing tag name, level digit, attributes, and inner HTMLStrips HTML tags to get plain text
Extracts id="value" from an attribute string
Matches <img ...> tags that do NOT already have a loading= attribute
(the lookahead is quote-aware too, so a loading= sitting after a
quoted > is still seen, and data-loading= doesn't count).
Known front-matter keys (shared between TOML, YAML, and JSON parsers). Using a Set for O(1) lookup instead of Array#includes? O(n).
Array-typed front matter keys that are NOT taxonomies. These are excluded from automatic taxonomy extraction.
Regex for TOML front matter
Regex for YAML front matter
Instance methods
Process content and return transformed result
Renders Markdown to HTML and generates a Table of Contents Returns {html_content, toc_headers} @param highlight - whether to enable syntax highlighting for code blocks @param safe - if true, raw HTML will not be passed through (replaced by comments) @param lazy_loading - if true, adds loading="lazy" to img tags @param emoji - if true, converts emoji shortcodes to emoji characters @param hooks - render-hook context; nil (the default) renders exactly as before this parameter existed.
Render with anchor links inserted into headings