Sign in

    himeno/mopress/bridge does not have a README file

    ProcessorError

    pub suberror ProcessorError {
    NonZeroExit(command~ : String, exit_code~ : Int, stderr~ : String)
    StderrReported(command~ : String, message~ : String)
    InvalidStdout(command~ : String, raw~ : String, reason~ : String)
    } derive(Eq,
    Debug
    )

    Error type describing why an external preprocessor/transformer command failed while running through run_markdown_preprocessors or run_markdown_transformers.

    MarkdownRequest

    type MarkdownRequest derive(ToJson)

    MarkdownResponse

    type MarkdownResponse derive(
    FromJson
    )

    TextRequest

    type TextRequest derive(ToJson)

    TextResponse

    type TextResponse derive(
    FromJson
    )

    run_markdown_preprocessors

    async fn run_markdown_preprocessors(config :
    BookConfig
    , data : String, target : String) -> String

    Runs a chain of external "preprocessor" commands over raw Markdown text, feeding the output of each command as the input to the next.

    Each command in the underlying pipeline receives a JSON payload on stdin of the shape:
    { "config": <BookConfig>, "type": "markdown-text", "data": <string>, "target": <string> }
    and is expected to write one of the following to stdout:
    • { "data": <string> } — the transformed text, which becomes the input to the next command in the chain.
    • An empty stdout — signals that this command does not want to modify the data; the current text is passed through unchanged to the next command.

    If a command exits with a non-zero status, or writes anything to stderr, this function raises ProcessorError and the chain is aborted; no further commands in the pipeline are executed.

    config is forwarded verbatim to every command invocation and is not itself modified by this function.

    run_markdown_transformers

    Runs a chain of external "transformer" commands over a Markdown AST, feeding the output of each command as the input to the next.

    This mirrors run_markdown_preprocessors, except the payload's data field carries a Markdown AST (Array[@markdown.Block]) rather than raw text, and the type field sent to each command is "markdown-ast" instead of "markdown-text".

    Each command receives on stdin:
    { "config": <BookConfig>, "type": "markdown-ast", "data": <Markdown AST>, "target": <string> }
    and must write to stdout either:
    • { "data": <Markdown AST> } — the transformed AST, passed on to the next command, or
    • an empty stdout — meaning this command leaves the AST unchanged.

    As with run_markdown_preprocessors, a non-zero exit code or any stderr output from a command raises ProcessorError and aborts the remaining chain.

    Source Files