Once Papyrix has loaded a Markdown ebook, it uses a MarkdownParser class to render it.
Skipping past the character-testing utils, near-empty constructor & destructor, resetter, & accessors... There's a helper to append a validated word (with nil byte appended & normalized to NFC Unicode-form) to the current text block while checking whether its Arabic & hence should be laid out right-to-left.
There's a helper to flush the existing text-block if any & set a new one with a given style.
1/?
Flushing a text block involves flushing the rest of the current word, validating that the paragraph's non-empty, initializing a new page if necessary, calculating line height taking into account configured line-compression, asking the text-block to apply its text-wrapping with a callback deferring valid data to another method, & checks whether we've exceeded a page-limit & the spacing level to update the Y coordinate or a `pendingSpacing_` property.
2/?