Skip to main content

Crate setzer_import

Crate setzer_import 

Source
Expand description

Manuscript importers. Every importer returns a Book plus warnings and never fails on odd input. Only input that is not a manuscript at all (empty, not a .docx) is an error.

Modules§

docx
.docx import.
markdown
The Kernsetzer Markdown dialect (M1 extends the M0 subset, see checklist).
scrub
The scrambled copy of a manuscript.

Structs§

Asset
An image file found in a manuscript, referenced by Block::Image::asset. An image file, e.g. assets/image1.png in a project.
ImportWarning
A non-fatal problem found while importing, shown to the author.
Imported

Enums§

ImportError
ReadError
Why a manuscript file could not be read.
WarningDetail
What a warning names. Tagged by kind with kebab-case values, fields in snake_case, like the façade’s other enums.
WarningKind
What a warning is about, so the UI can group and link warnings and tests can assert on them without matching prose.

Constants§

MAX_IMAGE_BYTES
Largest image we import.

Functions§

read_image
An image a Markdown manuscript refers to, relative to its folder. Reads at most one byte over the import limit, so the importer can tell a file that is too large without all of it in memory.
read_manuscript
The book, its images and the import warnings, by file extension (.md, .markdown, .docx). A Markdown manuscript’s images are read relative to its folder.
unique_id
File name for an image’s asset: the original base name (/ or \ paths), sanitized, with the extension that matches the content, made unique among assets.