module

Hwaro::Processor::Markdown

Constants

BODY_CACHE_MAX_BYTES = (32_i64 * 1024) * 1024

Class methods

filter_markdown_config

The site's [markdown] config, published for template filters (currently markdownify) that have no per-call config access. Set once per build in Phases::Initialize — mirroring SyntaxHighlighter.server_mode — so serve config reloads propagate; nil in library/spec contexts keeps the bare defaults.

Source
filter_markdown_config=(filter_markdown_config : Models::MarkdownConfig | Nil)

The site's [markdown] config, published for template filters (currently markdownify) that have no per-call config access. Set once per build in Phases::Initialize — mirroring SyntaxHighlighter.server_mode — so serve config reloads propagate; nil in library/spec contexts keeps the bare defaults.

Source

Instance methods

parse(raw_content : String, file_path : String = "")

Returns parsed metadata and content

Source
render(content : String, highlight : Bool = true, safe : Bool = false, lazy_loading : Bool = false, emoji : Bool = false, markdown_config : Models::MarkdownConfig | Nil = nil, hooks : Content::Processors::RenderHooks::HookRenderContext | Nil = nil) : Tuple(String, Array(Models::TocHeader))

Renders Markdown to HTML and generates a Table of Contents @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.

Source
render_body_cached(content : String, safe : Bool = false, emoji : Bool = false, lazy_loading : Bool = false, markdown_config : Models::MarkdownConfig | Nil = nil, hooks : Content::Processors::RenderHooks::HookRenderContext | Nil = nil, hooks_key : String | Nil = nil) : String

@param hooks - render-hook context for feed/search fallback rendering (see RenderHooks.fallback_context); nil when no registry is configured, in which case the memo key and render call are unaffected by this parameter. @param hooks_key - identifies the page for the hook page/config vars ("#{page.url}:#{page.language}"); only consulted when hooks is present, since the vars aren't otherwise part of the cache key.

Source
render_with_anchors(content : String, highlight : Bool = true, safe : Bool = false, anchor_style : String = "heading", lazy_loading : Bool = false, emoji : Bool = false, markdown_config : Models::MarkdownConfig | Nil = nil, hooks : Content::Processors::RenderHooks::HookRenderContext | Nil = nil) : Tuple(String, Array(Models::TocHeader))

Renders with anchor links injected into headings (delegates to shared instance)

Source