Ir para o conteúdo

tempest_fastapi_sdk.slides

Slides, gabaritos e documentos Markdown em PDF a partir de texto puro.

« Documentos e arquivos


parse_slides

parse_slides(
    text: str,
    *,
    deck_title: str | None = None,
    vocabulary: SlideVocabulary = DEFAULT_SLIDE_VOCABULARY,
    max_chars: int | None = DEFAULT_MAX_SOURCE_CHARS,
) -> SlideDeck

Parse structured text into a slide deck.

Each lesson header opens a lesson and becomes its cover slide. Inside it, a short capitalized line opens a section; paragraphs and bullets under a section become content and bullet slides, split so none overflows; a section whose title contains the vocabulary's conclusion_marker becomes conclusion slides. Content before the first lesson header goes into an implicit lesson 1.

Parameters:

Name Type Description Default
text str

The source text.

required
deck_title str | None

Overrides the deck title, which is otherwise the first lesson's title.

None
vocabulary SlideVocabulary

Markers to recognize and labels to print. English by default.

DEFAULT_SLIDE_VOCABULARY
max_chars int | None

Longest accepted source, in characters; None accepts any length.

DEFAULT_MAX_SOURCE_CHARS

Returns:

Name Type Description
SlideDeck SlideDeck

The deck, slides numbered from 1.

Raises:

Type Description
SlideSourceEmptyError

If text is empty or whitespace.

SlideSourceTooLargeError

If text is longer than max_chars.

parse_answer_key

parse_answer_key(
    text: str,
    *,
    title: str | None = None,
    subtitle: str | None = None,
    vocabulary: AnswerKeyVocabulary = DEFAULT_ANSWER_KEY_VOCABULARY,
    max_chars: int | None = DEFAULT_MAX_SOURCE_CHARS,
) -> AnswerKey

Parse structured text into an answer key.

A numbered line (1. or 1)) opens a question; the vocabulary's answer marker opens its answer, which runs until the next question or heading. A capitalized line that does not end like a sentence opens a section, but only outside a question or after a blank line, so a wrapped question keeps its second line. Sections left without questions are dropped.

Parameters:

Name Type Description Default
text str

The source text.

required
title str | None

Overrides the title line found in the text.

None
subtitle str | None

Overrides the subtitle line found in the text.

None
vocabulary AnswerKeyVocabulary

Markers to recognize and labels to print. English by default.

DEFAULT_ANSWER_KEY_VOCABULARY
max_chars int | None

Longest accepted source, in characters; None accepts any length.

DEFAULT_MAX_SOURCE_CHARS

Returns:

Name Type Description
AnswerKey AnswerKey

The answer key. Its title falls back, in order, to the

AnswerKey

title line, the first section's heading and the vocabulary's

AnswerKey

default_title.

Raises:

Type Description
SlideSourceEmptyError

If text is empty or whitespace.

SlideSourceTooLargeError

If text is longer than max_chars.

DEFAULT_MAX_SOURCE_CHARS module-attribute

DEFAULT_MAX_SOURCE_CHARS: int = 200000

Longest source text accepted, in characters. Ported from the MAX_TEXT_LENGTH default of Leviathan's slide-generator.

SlideRenderer

SlideRenderer(
    *,
    vocabulary: SlideVocabulary = DEFAULT_SLIDE_VOCABULARY,
    max_concurrent: int = DEFAULT_MAX_CONCURRENT_RENDERS,
)

Renders a :class:SlideDeck as HTML, PDF, PPTX, DOCX or Markdown.

Attributes:

Name Type Description
vocabulary SlideVocabulary

Labels printed on the slides.

Configure the renderer.

Parameters:

Name Type Description Default
vocabulary SlideVocabulary

Labels printed on the slides — pass the one the deck was parsed with.

DEFAULT_SLIDE_VOCABULARY
max_concurrent int

PDF, PPTX and DOCX renders allowed at once.

DEFAULT_MAX_CONCURRENT_RENDERS

Raises:

Type Description
ValueError

If max_concurrent is below 1.

html

html(deck: SlideDeck, *, theme: SlideThemeEnum = DEFAULT) -> str

Render the deck as a standalone HTML document.

Parameters:

Name Type Description Default
deck SlideDeck

The deck.

required
theme SlideThemeEnum

Colour scheme.

DEFAULT

Returns:

Name Type Description
str str

HTML with the CSS inlined and every value escaped.

markdown

markdown(deck: SlideDeck) -> str

Render the deck as reveal.js Markdown.

Parameters:

Name Type Description Default
deck SlideDeck

The deck.

required

Returns:

Name Type Description
str str

Slides separated by ---, notes under Note:.

pdf async

pdf(deck: SlideDeck, *, theme: SlideThemeEnum = DEFAULT) -> bytes

Render the deck as a PDF, one 1280x720 page per slide.

Parameters:

Name Type Description Default
deck SlideDeck

The deck.

required
theme SlideThemeEnum

Colour scheme.

DEFAULT

Returns:

Name Type Description
bytes bytes

The PDF.

Raises:

Type Description
ImportError

When the [slides] extra is missing.

pptx async

pptx(deck: SlideDeck, *, theme: SlideThemeEnum = DEFAULT) -> bytes

Render the deck as a PowerPoint file, speaker notes included.

Parameters:

Name Type Description Default
deck SlideDeck

The deck.

required
theme SlideThemeEnum

Colour scheme.

DEFAULT

Returns:

Name Type Description
bytes bytes

The .pptx file.

Raises:

Type Description
ImportError

When the [slides] extra is missing.

docx async

docx(deck: SlideDeck) -> bytes

Render the deck as a presenter handout, one slide per page.

Parameters:

Name Type Description Default
deck SlideDeck

The deck.

required

Returns:

Name Type Description
bytes bytes

The .docx file.

Raises:

Type Description
ImportError

When the [slides] extra is missing.

AnswerKeyRenderer

AnswerKeyRenderer(
    *,
    vocabulary: AnswerKeyVocabulary = DEFAULT_ANSWER_KEY_VOCABULARY,
    max_concurrent: int = DEFAULT_MAX_CONCURRENT_RENDERS,
)

Renders an :class:AnswerKey as HTML, PDF, DOCX or Markdown.

Attributes:

Name Type Description
vocabulary AnswerKeyVocabulary

Labels printed on the document.

Configure the renderer.

Parameters:

Name Type Description Default
vocabulary AnswerKeyVocabulary

Labels printed on the document — pass the one the answer key was parsed with.

DEFAULT_ANSWER_KEY_VOCABULARY
max_concurrent int

PDF and DOCX renders allowed at once.

DEFAULT_MAX_CONCURRENT_RENDERS

Raises:

Type Description
ValueError

If max_concurrent is below 1.

html

html(answer_key: AnswerKey, *, theme: SlideThemeEnum = DEFAULT) -> str

Render the answer key as a standalone HTML document.

Parameters:

Name Type Description Default
answer_key AnswerKey

The answer key.

required
theme SlideThemeEnum

Colour scheme.

DEFAULT

Returns:

Name Type Description
str str

HTML with the CSS inlined, tags stripped and every value

str

escaped.

markdown

markdown(answer_key: AnswerKey) -> str

Render the answer key as plain Markdown.

Parameters:

Name Type Description Default
answer_key AnswerKey

The answer key.

required

Returns:

Name Type Description
str str

The document.

pdf async

pdf(answer_key: AnswerKey, *, theme: SlideThemeEnum = DEFAULT) -> bytes

Render the answer key as an A4 PDF.

Parameters:

Name Type Description Default
answer_key AnswerKey

The answer key.

required
theme SlideThemeEnum

Colour scheme.

DEFAULT

Returns:

Name Type Description
bytes bytes

The PDF.

Raises:

Type Description
ImportError

When the [slides] extra is missing.

docx async

docx(answer_key: AnswerKey) -> bytes

Render the answer key as a Word document.

Parameters:

Name Type Description Default
answer_key AnswerKey

The answer key.

required

Returns:

Name Type Description
bytes bytes

The .docx file.

Raises:

Type Description
ImportError

When the [slides] extra is missing.

SlideVocabulary dataclass

SlideVocabulary(
    lesson_pattern: str = "^Lesson\\s+(\\d+)\\s*:\\s*(.+?)\\s*$",
    notes_pattern: str = "^(?:Notes|Note)\\s*:\\s*(.+)$",
    conclusion_marker: str = "conclusion",
    sentence_verbs: tuple[str, ...] = DEFAULT_SENTENCE_VERBS,
    ignored_lines: frozenset[str] = frozenset(),
    default_lesson_title: str = "Content",
    default_deck_title: str = "Slides",
    lesson_label: str = "Lesson {index}",
    conclusion_label: str = "Conclusion",
    handout_subtitle: str = "Presenter handout",
    handout_cover_note: str = "Cover slide.",
    notes_heading: str = "Speaker notes",
    slide_label: str = "Slide",
    language: str = "en",
)

Markers the slide parser reads and labels the slide renderers print.

Attributes:

Name Type Description
lesson_pattern str

Regular expression matching a lesson header, case-insensitive, with group 1 the lesson number and group 2 its title.

notes_pattern str

Regular expression matching a speaker-notes line, case-insensitive, with group 1 the note text. The note attaches to the paragraph or bullet right above it.

conclusion_marker str

Lowercase fragment that, found in a section title, renders that section as a conclusion slide.

sentence_verbs tuple[str, ...]

Space-padded verbs whose presence in a Head: tail head means the line is prose.

ignored_lines frozenset[str]

Lowercase lines dropped wherever they appear — the button labels and watermarks text copied from a web page carries along.

default_lesson_title str

Title of the implicit lesson created when content appears before any lesson header.

default_deck_title str

Deck title when the text has no lesson header and the caller passed none.

lesson_label str

Eyebrow of a lesson's slides; {index} is the lesson number.

conclusion_label str

Eyebrow of a conclusion slide.

handout_subtitle str

Line under the title on the DOCX cover.

handout_cover_note str

Placeholder text of a lesson-title page in the DOCX handout.

notes_heading str

Heading of the speaker-notes block in the DOCX handout.

slide_label str

Word before the number in the DOCX footer.

language str

BCP 47 tag written to <html lang>.

lesson_re Pattern[str]

lesson_pattern, compiled case-insensitively at construction.

notes_re Pattern[str]

notes_pattern, compiled the same way.

lesson

lesson(index: int) -> str

Format lesson_label for one lesson.

Parameters:

Name Type Description Default
index int

The lesson number.

required

Returns:

Name Type Description
str str

The label, e.g. "Lesson 2".

AnswerKeyVocabulary dataclass

AnswerKeyVocabulary(
    title_prefixes: tuple[str, ...] = ("title:",),
    subtitle_prefixes: tuple[str, ...] = ("subtitle:",),
    answer_pattern: str = "^(?:A|Answer)\\s*[:.]\\s*(.*)$",
    default_title: str = "Answer key",
    answer_label: str = "Answer:",
    footer: str | None = None,
    language: str = "en",
)

Markers the answer-key parser reads and labels its renderers print.

Attributes:

Name Type Description
title_prefixes tuple[str, ...]

Lowercase prefixes of the line that sets the document title.

subtitle_prefixes tuple[str, ...]

Lowercase prefixes of the line that sets the subtitle.

answer_pattern str

Regular expression matching the first line of an answer, case-insensitive, with group 1 the text after the marker (possibly empty, when the answer starts on the next line).

default_title str

Title when neither the caller nor the text gives one and the first section has no heading.

answer_label str

Label printed before each answer.

footer str | None

Line closing the HTML and PDF document; None prints none.

language str

BCP 47 tag written to <html lang>.

answer_re Pattern[str]

answer_pattern, compiled case-insensitively at construction.

DEFAULT_SLIDE_VOCABULARY module-attribute

DEFAULT_SLIDE_VOCABULARY: SlideVocabulary = SlideVocabulary()

English markers and labels — what the slide functions use when given none.

DEFAULT_ANSWER_KEY_VOCABULARY module-attribute

DEFAULT_ANSWER_KEY_VOCABULARY: AnswerKeyVocabulary = AnswerKeyVocabulary()

English markers and labels — what the answer-key functions use when given none.

DEFAULT_SENTENCE_VERBS module-attribute

DEFAULT_SENTENCE_VERBS: tuple[str, ...] = (
    " is ",
    " are ",
    " was ",
    " were ",
    " will be ",
    " has ",
    " have ",
    " had ",
    " means ",
    " refers to ",
)

Verbs that mark a Head: tail line as a sentence, not a bullet.

The result is: 42 after the second pass has a capitalized head and a long tail, so it passes every shape test a Term: description bullet has; the verb inside the head is what tells it apart. Each entry is padded with spaces because the head is searched as <head lowercased>.

SlideDeck

Bases: BaseSchema

The ordered slides produced from one source text.

Attributes:

Name Type Description
title str

Deck title, printed in every footer.

slides list[Slide]

The slides, in presentation order.

total property

total: int

Return how many slides the deck has.

Returns:

Name Type Description
int int

len(self.slides).

Slide

Bases: BaseSchema

A single slide, ready to render.

Attributes:

Name Type Description
kind SlideKindEnum

Which layout the slide uses.

title str

Title shown at the top.

subtitle str | None

Eyebrow of a lesson-title slide.

paragraphs list[str]

Body paragraphs of a content or conclusion slide.

bullets list[SlideBullet]

Items of a bullets slide.

lesson_index int | None

1-based index of the lesson the slide belongs to, shown as the eyebrow of content slides.

slide_number int

1-based position in the deck, shown in the footer.

notes str | None

Speaker notes. PPTX puts them in the notes pane, DOCX under each page, Markdown in a reveal.js Note: block; HTML and PDF leave them out.

SlideBullet

Bases: BaseSchema

One item of a BULLETS slide.

Attributes:

Name Type Description
term str | None

Highlighted lead shown before the description.

description str

The item's body.

SlideKindEnum

Bases: BaseStrEnum

The visual variant a slide is rendered as.

Attributes:

Name Type Description
LESSON_TITLE

The cover of a lesson — eyebrow plus a large title.

SECTION

A section divider. No parser emits it today; it exists so a deck built by hand can mark one.

CONTENT

Paragraphs under a title.

BULLETS

A list of term: description items under a title.

CONCLUSION

Paragraphs under a title, labelled as the conclusion.

SlideThemeEnum

Bases: BaseStrEnum

The colour scheme applied by the HTML, PDF and PPTX renderers.

Attributes:

Name Type Description
DEFAULT

Dark text on white, blue accents.

DARK

Light text on a near-black slate background.

AnswerKey

Bases: BaseSchema

A whole answer key.

Attributes:

Name Type Description
title str

Document title.

subtitle str | None

Line under the title.

sections list[AnswerKeySection]

The sections, in order.

total_items property

total_items: int

Return how many questions the answer key has.

Returns:

Name Type Description
int int

The item count summed over every section.

AnswerKeySection

Bases: BaseSchema

A titled group of questions.

Attributes:

Name Type Description
title str

Heading above the items; empty for questions that appear before any heading.

items list[AnswerKeyItem]

The questions, in order.

AnswerKeyItem

Bases: BaseSchema

One question and its answer.

Attributes:

Name Type Description
question str

The question, numbering included.

answer str

The expected answer.

MarkdownPdfRenderer

MarkdownPdfRenderer(
    *,
    stylesheet: str = DEFAULT_MARKDOWN_CSS,
    max_chars: int | None = DEFAULT_MAX_SOURCE_CHARS,
    max_archive_bytes: int = DEFAULT_MAX_ARCHIVE_BYTES,
    max_archive_members: int = DEFAULT_MAX_ARCHIVE_MEMBERS,
    mermaid_timeout: float = DEFAULT_MERMAID_TIMEOUT,
    mermaid_error_message: str = DEFAULT_MERMAID_ERROR,
    default_title: str = DEFAULT_DOCUMENT_TITLE,
    max_concurrent: int = DEFAULT_MAX_CONCURRENT_RENDERS,
)

Turns Markdown into PDF with a stylesheet the service chooses.

Raw text is laid out by one renderer whose policy denies every fetch; an archive gets a renderer per call allowed to read only its own extraction directory. Both paths share one max_concurrent limit.

Attributes:

Name Type Description
stylesheet str

CSS inlined into every document.

max_chars int | None

Longest Markdown accepted, in characters.

max_archive_bytes int

Largest uncompressed archive accepted.

max_archive_members int

Most entries an archive may hold.

mermaid_timeout float

Seconds each Mermaid diagram has.

mermaid_error_message str

Sentence printed in place of a diagram that did not render.

default_title str

Title of a raw document rendered without one.

Configure the renderer.

Parameters:

Name Type Description Default
stylesheet str

CSS inlined into every document.

DEFAULT_MARKDOWN_CSS
max_chars int | None

Longest Markdown accepted, in characters; None accepts any length.

DEFAULT_MAX_SOURCE_CHARS
max_archive_bytes int

Largest total uncompressed size an archive may declare.

DEFAULT_MAX_ARCHIVE_BYTES
max_archive_members int

Most entries an archive may hold.

DEFAULT_MAX_ARCHIVE_MEMBERS
mermaid_timeout float

Seconds each Mermaid diagram has.

DEFAULT_MERMAID_TIMEOUT
mermaid_error_message str

Sentence printed in place of a diagram that did not render.

DEFAULT_MERMAID_ERROR
default_title str

Title of a raw document rendered without one.

DEFAULT_DOCUMENT_TITLE
max_concurrent int

Documents laid out at once.

DEFAULT_MAX_CONCURRENT_RENDERS

Raises:

Type Description
ValueError

If max_concurrent is below 1.

render async

render(
    text: str, *, title: str | None = None, render_mermaid: bool = False
) -> MarkdownPdf

Render Markdown text to PDF.

Parameters:

Name Type Description Default
text str

The Markdown.

required
title str | None

Document title; default_title when omitted.

None
render_mermaid bool

Whether to draw ```mermaid blocks (needs [slides-mermaid] and Chromium).

False

Returns:

Name Type Description
MarkdownPdf MarkdownPdf

The PDF and the title used.

Raises:

Type Description
SlideSourceEmptyError

If the text is empty or whitespace.

SlideSourceTooLargeError

If the text exceeds max_chars.

AssetRefused

If the Markdown references any URL — raw text has no directory to resolve against. details carries only refused_count, never the URLs.

ImportError

When the [slides] extra is missing.

render_archive async

render_archive(
    data: bytes, *, title: str | None = None, render_mermaid: bool = False
) -> MarkdownPdf

Render a zip holding one Markdown file and the images it references.

The first .md file in path order is the document; relative image paths resolve against its directory, and nothing outside the extracted archive can be read.

Parameters:

Name Type Description Default
data bytes

The zip archive.

required
title str | None

Document title; the Markdown file's name without extension when omitted.

None
render_mermaid bool

Whether to draw ```mermaid blocks.

False

Returns:

Name Type Description
MarkdownPdf MarkdownPdf

The PDF and the title used.

Raises:

Type Description
MarkdownArchiveError

If the archive is not a zip, holds an entry that would land outside the extraction directory, is too large or has too many entries, has no .md file, or its Markdown is not UTF-8.

SlideSourceEmptyError

If the Markdown file is empty.

SlideSourceTooLargeError

If the Markdown exceeds max_chars.

AssetRefused

If the Markdown references a URL outside the archive. details carries only refused_count.

MarkdownPdf dataclass

MarkdownPdf(content: bytes, title: str)

A rendered document and the title it was rendered under.

Attributes:

Name Type Description
content bytes

The PDF.

title str

The title used — the caller's, or for an archive the Markdown file's name without extension. Useful as the download file name.

DEFAULT_MAX_ARCHIVE_BYTES module-attribute

DEFAULT_MAX_ARCHIVE_BYTES: int = 50 * 1024 * 1024

Largest total uncompressed size an archive may declare.

DEFAULT_MAX_ARCHIVE_MEMBERS module-attribute

DEFAULT_MAX_ARCHIVE_MEMBERS: int = 500

Most entries an archive may hold.

DEFAULT_MARKDOWN_CSS module-attribute

DEFAULT_MARKDOWN_CSS: str = (
    '\n@page {\n    size: A4;\n    margin: 2.5cm 2cm;\n    @bottom-center {\n        content: counter(page);\n        font-size: 9pt;\n        color: #6b7280;\n    }\n}\n\nbody {\n    font-family: "DejaVu Sans", "Liberation Sans", Helvetica, Arial, sans-serif;\n    font-size: 11pt;\n    line-height: 1.5;\n    color: #1f2937;\n}\n\nh1, h2, h3, h4, h5, h6 {\n    font-weight: bold;\n    line-height: 1.25;\n    margin-top: 18pt;\n    margin-bottom: 8pt;\n}\n\nh1 { font-size: 20pt; }\nh2 { font-size: 16pt; }\nh3 { font-size: 13pt; }\nh4, h5, h6 { font-size: 11pt; }\n\np, ul, ol { margin-bottom: 10pt; }\n\nli { margin-bottom: 4pt; }\n\n.codehilite, pre {\n    background: #f3f4f6;\n    border-radius: 4px;\n    padding: 10px;\n    font-family: "DejaVu Sans Mono", "Courier New", monospace;\n    font-size: 9pt;\n    white-space: pre-wrap;\n}\n\ncode {\n    font-family: "DejaVu Sans Mono", "Courier New", monospace;\n    font-size: 9.5pt;\n}\n\ntable {\n    border-collapse: collapse;\n    width: 100%;\n    margin: 12px 0;\n    font-size: 10pt;\n}\n\nth, td {\n    border: 1px solid #d1d5db;\n    padding: 5px 8px;\n    text-align: left;\n}\n\nth { background-color: #f3f4f6; }\n\nblockquote {\n    border-left: 3px solid #d1d5db;\n    margin-left: 0;\n    padding-left: 12px;\n    color: #4b5563;\n}\n\nimg {\n    max-width: 100%;\n    display: block;\n    margin: 12px auto;\n}\n\n.footnote { font-size: 9pt; }\n'
    + _MERMAID_CSS
)

Neutral stylesheet — what :class:MarkdownPdfRenderer uses when given none.

ABNT_MARKDOWN_CSS module-attribute

ABNT_MARKDOWN_CSS: str = (
    '\n@page {\n    size: A4;\n    margin: 3cm 2cm 2cm 3cm;\n    @bottom-center {\n        content: counter(page);\n        font-family: "Times New Roman";\n        font-size: 10pt;\n    }\n}\n\nbody {\n    font-family: "Times New Roman", serif;\n    font-size: 12pt;\n    text-align: justify;\n    line-height: 1.5;\n    color: #000000;\n    padding-top: 20px;\n}\n\nh1 {\n    font-size: 14pt;\n    font-weight: bold;\n    text-align: center;\n    margin-top: 30pt;\n    margin-bottom: 18pt;\n    text-transform: uppercase;\n}\n\nh2 {\n    font-size: 12pt;\n    font-weight: bold;\n    text-align: left;\n    margin-top: 24pt;\n    margin-bottom: 12pt;\n}\n\nh3, h4, h5, h6 {\n    font-size: 12pt;\n    font-weight: bold;\n    text-align: left;\n    margin-top: 18pt;\n    margin-bottom: 12pt;\n}\n\np {\n    margin-bottom: 12pt;\n    text-indent: 1.25cm;\n}\n\nul, ol {\n    margin-bottom: 12pt;\n    margin-left: 1.25cm;\n}\n\nli {\n    margin-bottom: 6pt;\n}\n\n.codehilite, pre {\n    background: #f8f8f8;\n    border: 1px solid #ddd;\n    border-radius: 3px;\n    padding: 10px;\n    margin: 15px 0;\n    overflow: auto;\n    font-family: "Courier New", monospace;\n    font-size: 10pt;\n}\n\ntable {\n    border-collapse: collapse;\n    width: 100%;\n    margin: 15px 0;\n    font-size: 10pt;\n}\n\nth, td {\n    border: 1px solid #000;\n    padding: 5px 8px;\n    text-align: center;\n}\n\nth {\n    background-color: #f2f2f2;\n    font-weight: bold;\n}\n\n.MathJax_Display, .arithmatex {\n    text-align: center;\n    margin: 15px 0;\n    font-size: 11pt;\n}\n\nstrong, b {\n    font-weight: bold;\n}\n\nem, i {\n    font-style: italic;\n}\n\nimg {\n    max-width: 100%;\n    display: block;\n    margin: 15px auto;\n    text-align: center;\n}\n\n.footnote {\n    font-size: 10pt;\n}\n'
    + _MERMAID_CSS
)

ABNT NBR 14724 page layout. Ported from ABNT_CSS in Leviathan's slide-generator (abnt_styles.py), margins corrected to the norm.

SlideSourceEmptyError

SlideSourceEmptyError(
    message: str | None = None,
    *,
    code: str | None = None,
    status_code: int | None = None,
    details: dict[str, Any] | None = None,
    headers: dict[str, str] | None = None,
    message_key: str | None = None,
    message_params: dict[str, Any] | None = None,
    field: str | None = None,
)

Bases: ValidationException

Raised when the text to parse or render is empty or whitespace.

SlideSourceTooLargeError

SlideSourceTooLargeError(limit: int)

Bases: AppException

Raised when the text to parse or render exceeds the configured limit.

The limit travels in message_params as limit, so the catalog sentence names it in the caller's language.

Initialize the exception.

Parameters:

Name Type Description Default
limit int

The maximum length, in characters.

required

MarkdownArchiveError

MarkdownArchiveError(reason: str)

Bases: ValidationException

Raised when a Markdown archive cannot be turned into a document.

details["reason"] says which check failed — not_a_zip, unsafe_member, too_large, too_many_members, no_markdown or not_utf8 — so a client can branch without parsing prose. The member name of an unsafe entry is never included: it is attacker-chosen text.

Initialize the exception.

Parameters:

Name Type Description Default
reason str

Which check failed.

required