Skip to main content

Module prelude

Module prelude 

Source

Structs§

CaseConversion
A reusable case-conversion descriptor.
Line
A numbered logical line.
LineNumber
A 1-based line number.
LineStats
Aggregate line counts derived from text.
MarkdownCodeFence
A fenced code block extracted from Markdown.
MarkdownHeading
A Markdown ATX heading.
MarkdownImage
A Markdown inline image.
MarkdownLink
A Markdown inline link.
MarkdownOutline
A simple heading outline for a Markdown document.
Slug
A validated default-separator slug.
SlugOptions
Configures conservative slug shaping.
Token
A token with its kind and byte span.
TokenSpan
A byte span in the original input string.
TokenizerOptions
Small configuration for future tokenizer extensions.
Word
A normalized word token.
WordStats
Aggregate counts derived from text.

Enums§

CaseError
Errors returned by CaseConversion.
LineEnding
Supported line-ending shapes.
SlugSeparator
Supported separators for generated slugs.
TextCase
Describes a detected or requested text case.
TokenKind
The category assigned to a token.

Functions§

contains_word
Returns true when the input contains the target as a full normalized word.
dedent_lines
Removes the common indentation shared by non-empty lines.
detect_case
Detects the most practical case shape for the input.
ends_with_word
Returns true when the last normalized word matches the target.
extract_code_fences
Extracts fenced code blocks delimited by triple backticks or triple tildes.
extract_frontmatter
Extracts top-of-document frontmatter contents without the boundary lines.
extract_headings
Extracts ATX headings while ignoring content inside fenced code blocks.
extract_images
Extracts inline images while ignoring fenced code blocks.
extract_links
Extracts inline links while ignoring fenced code blocks.
extract_outline
Extracts a lightweight document outline from headings.
has_frontmatter
Returns true when the document starts with YAML-like or TOML-like frontmatter.
heading_to_anchor
Converts heading text into a practical GitHub-style anchor.
indent_lines
Prefixes each logical line with the provided indent string.
is_blockquote
Returns true when a line starts with a Markdown blockquote marker.
is_horizontal_rule
Returns true when a line looks like a Markdown horizontal rule.
is_ordered_list_item
Returns true when a line starts with an ordered list marker.
is_slug
Returns true when the input is already a normalized default slug.
is_unordered_list_item
Returns true when a line starts with an unordered list marker.
line_count
Counts logical lines, ignoring a trailing empty line created only by a final line ending.
lines_with_numbers
Returns numbered logical lines.
markdown_to_plain_text
Converts Markdown into lightweight plain text.
non_empty_line_count
Counts logical lines whose trimmed content is not empty.
normalize_line_endings
Normalizes line endings to the requested target.
normalize_slug
Normalizes a candidate slug using the default separator.
normalize_word
Normalizes a word-like value by lowercasing letters and dropping non-word punctuation.
slug_words
Returns the normalized slug segments.
slugify
Converts free-form text into a default slug.
starts_with_word
Returns true when the first normalized word matches the target.
strip_frontmatter
Returns the document without a leading frontmatter block.
to_camel_case
Converts input into camelCase.
to_constant_case
Converts input into CONSTANT_CASE.
to_kebab_case
Converts input into kebab-case.
to_pascal_case
Converts input into PascalCase.
to_snake_case
Converts input into snake_case.
to_title_case
Converts input into title case separated by spaces.
token_count
Counts conservative word tokens.
tokenize_chars
Splits input into Unicode scalar values.
tokenize_sentences
Extracts conservative sentence tokens.
tokenize_whitespace
Splits input on contiguous whitespace.
tokenize_words
Extracts conservative word tokens.
trim_lines
Trims each logical line independently and preserves the input line-ending style when possible.
truncate_slug
Truncates a slug without leaving trailing separators when possible.
unique_words
Returns distinct normalized words in first-seen order.
word_count
Counts normalized words in the input.
words
Extracts normalized words from the input.