Guidedog マニュアル 0.2.0
言語
このページの内容
Guidedog / ドキュメント 0.2.0

render/text

Package text_render renders a Guidedoc document as plain text without calling an allocator, following the conventions of Sphinx’s text builder: paragraphs wrapped at 70 columns, titles underlined with = - ~ and the other section characters, 「* 「 and 「1. 「 list markers with hanging indents, definitions and literal blocks indented by three spaces, grid tables drawn with +—+ borders, and 「Note:」 admonitions.

Inline content is laid out twice, once to measure and once into scratch, and then wrapped; table cells are laid out into scratch at trial widths before the table is drawn. Output goes only through the emitter, so the engine’s measure and write runs produce identical bytes.

Procedures

text.render :: proc(ctx: ^gd.Render_Context) -> gd.Status

render writes ctx.view as plain text through ctx.out. It borrows the context for the call and keeps nothing; its scratch is released before it returns. Problems go to ctx.reports; the result is .Ok, the status of the first error (raw content the policy refuses, an unresolved reference, nesting past the limits), or .Capacity when scratch cannot hold the indentation frames or a laid-out paragraph.

text.renderer :: proc() -> gd.Renderer

renderer returns the 「text」 renderer descriptor, for a gd.Registry. It is a value with no state: registering it twice or copying it is harmless.

Constants

text.CONFORMANCE :: gd.Conformance.Partial
text.VERSION :: "0.1.0"