Module utils
Source - codeblock
- UtilError
- Error type for utility operations.
- capitalize_first
- Capitalize the first letter of a string.
- clean_anchor_patterns
- Clean anchor patterns from text (removes
{#anchor-id} patterns).
This is useful for cleaning titles and navigation text. - extract_markdown_title
- Extract the first heading from markdown content as the page title.
Returns
None if no heading is found. - extract_markdown_title_and_id
- Extract the first H1 heading from markdown content as the document title.
Removes inline anchors and other markup from the title text.
- is_markdown_header
- Return true if the string looks like a markdown header (starts with #).
- load_manpage_urls
- Load manpage URL mappings from a JSON file.
- never_matching_regex
- Create a regex that never matches anything.
- process_html_elements
- Apply a regex transformation to HTML elements using the provided function.
Used by the markdown processor for HTML element transformations.
- slugify
- Slugify a string for use as an anchor ID.
Converts to lowercase, replaces non-alphanumeric characters with dashes,
and trims leading/trailing dashes.
- strip_markdown
- Strip markdown formatting and return plain text.
- UtilResult
- Result type for utility operations.