Sign in

    moui_markdown

    Reusable Markdown editing chrome components for MoUI (outline, find/replace, format palette, document info, HTML export)

    moui
    markdown
    editor
    addon
    Download zip
    Author
    Version
    0.2.2
    License
    Apache-2.0
    Last updated
    17 hours ago
    Downloads
    5

    wzzc-dev/moui_markdown does not have a README file

    MarkdownDocumentInfo

    pub(all) struct MarkdownDocumentInfo {
    character_count : Int
    heading_count : Int
    paragraph_count : Int
    list_item_count : Int
    task_count : Int
    checked_task_count : Int
    quote_count : Int
    code_block_count : Int
    table_count : Int
    link_count : Int
    image_count : Int
    footnote_reference_count : Int
    footnote_definition_count : Int
    } derive(Eq, ToJson,
    Debug
    )

    Block and inline statistics for a Markdown document.

    MarkdownDocumentInfo::equal

    MarkdownDocumentInfo::not_equal

    MarkdownDocumentInfo::to_json

    MarkdownFindOptions

    pub(all) struct MarkdownFindOptions {
    case_sensitive : Bool
    whole_word : Bool
    regex : Bool
    } derive(Eq, ToJson,
    Debug
    )

    Find/replace options. Defaults are case-insensitive substring matching.

    pub(all): consumers outside this package must be able to build non-default option sets (the find-bar toggles write these fields).

    MarkdownFindOptions::default

    MarkdownFindOptions::equal

    MarkdownFindOptions::not_equal

    MarkdownFindOptions::to_json

    MarkdownFindSeed

    pub(all) struct MarkdownFindSeed {
    query : String
    range :
    TextRange

    } derive(Eq, ToJson,
    Debug
    )

    A find query seeded from the caret word: query is the text, range the selection to activate once the find bar opens.

    MarkdownFindSeed::equal

    MarkdownFindSeed::not_equal

    fn MarkdownFindSeed::not_equal(x : MarkdownFindSeed, y : MarkdownFindSeed) -> Bool

    MarkdownFindSeed::to_json

    MarkdownPaletteItem

    pub(all) struct MarkdownPaletteItem {
    action : String
    label : String
    group : String
    shortcut : String
    } derive(Eq, ToJson,
    Debug
    )

    One quick-format palette entry.

    MarkdownPaletteItem::equal

    MarkdownPaletteItem::not_equal

    MarkdownPaletteItem::to_json

    markdown_active_outline_index

    fn markdown_active_outline_index(outline : Array[
    MarkdownEditorOutlineItem
    ], caret : Int) -> Int

    The index of the outline item containing caret (the last heading whose source start is at or before the caret), or -1 when no heading precedes it.

    markdown_command_from_palette_action

    fn markdown_command_from_palette_action(action : String) ->
    MarkdownEditorCommand
    ?

    Map a palette action id to its editor command. Actions with no engine command (view toggles, export, files, appearance) return None.

    markdown_document_info_from_parts

    fn markdown_document_info_from_parts(source : String, blocks : Array[
    MarkdownEditorBlock
    ]) -> MarkdownDocumentInfo

    Compute document info from raw source + parsed editor blocks.

    markdown_document_info_from_session

    Compute document info from a live session.

    markdown_document_info_from_snapshot

    Compute document info from a snapshot.

    markdown_document_info_panel

    fn[Msg] markdown_document_info_panel(theme~ :
    Theme
    , info~ : MarkdownDocumentInfo, word_count~ : Int, line_count~ : Int, reading_time_label~ : String, height~ : Double, width? : Double, title? : String, words_label? : String, characters_label? : String, lines_label? : String, reading_label? : String, headings_label? : String, paragraphs_label? : String, list_items_label? : String, tasks_label? : String, quotes_label? : String, code_blocks_label? : String, tables_label? : String, links_label? : String, images_label? : String, footnotes_label? : String) ->
    View
    [Msg]

    The document-info inspector. Counts come from markdown_document_info_from_session/_from_snapshot; word/line/reading values are passed explicitly so snapshot-based hosts work too.

    markdown_find_active_index

    Index of the match exactly equal to the current selection, or -1.

    markdown_find_bar

    fn[Msg] markdown_find_bar(theme~ :
    Theme
    , query~ : String, replace_text~ : String, options~ : MarkdownFindOptions, status_label~ : String, on_query_input~ : (String) -> Msg, on_replace_input~ : (String) -> Msg, on_submit_query~ : Msg, on_submit_replace~ : Msg, on_toggle_case_sensitive~ : Msg, on_toggle_whole_word~ : Msg, on_toggle_regex~ : Msg, on_previous~ : Msg, on_next~ : Msg, on_replace_current~ : Msg, on_replace_all~ : Msg, on_close~ : Msg, width~ : Double, find_label? : String, replace_label? : String, search_placeholder? : String, replacement_placeholder? : String, replace_button_label? : String, replace_all_button_label? : String, match_case_tooltip? : String, whole_word_tooltip? : String, regex_tooltip? : String, previous_tooltip? : String, next_tooltip? : String, close_tooltip? : String, key_prefix? : String) ->
    View
    [Msg]

    The find/replace bar. status_label is normally markdown_find_status_label(query, matches, selection, options~), but any caller-composed label (e.g. localized text) works too.

    The bar is width wide and 42pt tall, matching MoMark's chrome slot.

    markdown_find_compile_regex

    fn markdown_find_compile_regex(query : String, case_sensitive : Bool) ->
    Regex
    ?

    Compile query into a regex, wrapping case-insensitively when needed. Returns None for invalid patterns.

    markdown_find_live_update_index

    Index to keep active across a live find refresh: the match starting at the current selection start (stable while the end changes), else the next match.

    markdown_find_matches

    fn markdown_find_matches(source : String, query : String, options? : MarkdownFindOptions) -> Array[
    TextRange
    ]

    All matches of query in source, in document order.

    markdown_find_next_index

    Index of the next match at or after the selection end, wrapping to the first match.

    markdown_find_previous_index

    Index of the previous match ending at or before the selection start, wrapping to the last match.

    markdown_find_query_from_selection

    fn markdown_find_query_from_selection(source : String, selection :
    MarkdownEditorSelection
    ) -> String?

    The query to seed when the find bar opens over a non-empty single-line selection.

    markdown_find_seed_from_caret_word

    fn markdown_find_seed_from_caret_word(source : String, selection :
    MarkdownEditorSelection
    ) -> MarkdownFindSeed?

    The find seed around a collapsed caret: the ASCII word under or directly before the caret. Returns None when the caret is not on a word.

    markdown_find_status_label

    fn markdown_find_status_label(query : String, matches : Array[
    TextRange
    ], selection :
    MarkdownEditorSelection
    , options? : MarkdownFindOptions) -> String

    The find-bar status label: "Ready", "Invalid regex", "No match", or the active match position ("n/m").

    markdown_folded_outline

    Filter outline items to honor folded headings: a folded heading hides all subsequent items until the next heading at the same or higher level.

    markdown_format_palette

    fn[Msg] markdown_format_palette(theme~ :
    Theme
    , query~ : String, items~ : Array[MarkdownPaletteItem], on_query_input~ : (String) -> Msg, on_submit~ : Msg, on_action~ : (String) -> Msg, on_done~ : Msg, width~ : Double, title? : String, filter_placeholder? : String, done_label? : String, empty_label? : String, key_prefix? : String) ->
    View
    [Msg]

    The quick-format palette overlay. items is normally markdown_format_palette_filtered_items(query); callers may pass a custom catalog. on_action receives the selected action id (see markdown_command_from_palette_action).

    markdown_format_palette_filtered_items

    fn markdown_format_palette_filtered_items(query : String) -> Array[MarkdownPaletteItem]

    Case-insensitive substring filter over label/group/shortcut. A blank query returns the full catalog.

    markdown_format_palette_items

    fn markdown_format_palette_items() -> Array[MarkdownPaletteItem]

    The full quick-format command catalog, in display order.

    markdown_format_palette_matches

    fn markdown_format_palette_matches(item : MarkdownPaletteItem, needle : String) -> Bool

    Whether a (already lowercased) needle matches an entry.

    markdown_html_blocks

    fn markdown_html_blocks(blocks : Array[
    MarkdownEditorBlock
    ]) -> String

    Render block-level HTML for parsed editor blocks.

    markdown_html_document

    fn markdown_html_document(snapshot :
    MarkdownEditorSnapshot
    , title : String) -> String

    Render a full standalone HTML document from a snapshot.

    markdown_html_escape_attribute

    fn markdown_html_escape_attribute(text : String) -> String

    Escape &, <, >, ", ' for HTML attribute values.

    markdown_html_escape_text

    fn markdown_html_escape_text(text : String) -> String

    Escape &, <, > for HTML text content.

    markdown_html_inlines

    fn markdown_html_inlines(inlines : Array[
    MarkdownInline
    ]) -> String

    Render inline-level HTML for parsed inlines.

    markdown_next_match_after_replacement

    fn markdown_next_match_after_replacement(matches : Array[
    TextRange
    ], replaced_start : Int, replacement_end : Int) ->
    TextRange
    ?

    The match to activate after replacing [replaced_start, replacement_end): the first match at/after the replacement, else the first one before it.

    markdown_outline_indent_width

    fn markdown_outline_indent_width(level : Int) -> Double

    The indent width in points for a heading at level (12pt per level below the first).

    markdown_outline_item_is_active

    True when item is the outline entry at active_index in full_outline (identity by source start, so folding keeps the highlight attached).

    markdown_outline_label

    The bounded outline label for an item, e.g. "H2 Install". Titles longer than 24 characters are truncated to 21 + "..."; empty titles become "Untitled".

    markdown_outline_panel

    fn[Msg] markdown_outline_panel(theme~ :
    Theme
    , outline~ : Array[
    MarkdownEditorOutlineItem
    ], folded_starts~ : Array[Int], caret~ : Int, on_jump~ : (Int) -> Msg, on_toggle_fold~ : (Int) -> Msg, height~ : Double, width? : Double, title? : String, empty_label? : String) ->
    View
    [Msg]

    The outline inspector for a live session. folded_starts lists heading source_starts whose children are hidden; rows jump via on_jump and toggle folding via on_toggle_fold.

    markdown_outline_truncate_title

    fn markdown_outline_truncate_title(title : String) -> String

    Truncate a heading title to the outline label budget.

    markdown_replace_all_matches

    fn markdown_replace_all_matches(source : String, matches : Array[
    TextRange
    ], replacement : String) -> String

    Replace all matches in a single pass. Matches must be sorted and non-overlapping; out-of-order/ranges past the end are clamped and skipped.

    markdown_replace_source_range

    fn markdown_replace_source_range(source : String, range :
    TextRange
    , replacement : String) -> String

    Replace one character-index range with replacement.

    markdown_session_reading_label

    fn markdown_session_reading_label(session :
    MarkdownDocumentSession
    ) -> String

    "N words / M lines / T min" reading label from a session.

    markdown_session_reading_time_short_label

    fn markdown_session_reading_time_short_label(session :
    MarkdownDocumentSession
    ) -> String

    The compact reading reference ("<1 min"/"1 min"/"N min") from a session.

    markdown_snapshot_reading_label

    fn markdown_snapshot_reading_label(snapshot :
    MarkdownEditorSnapshot
    ) -> String

    "N words / M lines / T min" reading label from a snapshot.

    markdown_snapshot_reading_time_short_label

    fn markdown_snapshot_reading_time_short_label(snapshot :
    MarkdownEditorSnapshot
    ) -> String

    The compact reading reference from a snapshot.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io