Skip to main content

process

Function process 

Source
pub fn process(
    body: &str,
    bibliography: &Bibliography,
    style: &CiteStyle,
) -> Result<String>
Expand description

Rewrites every [@key] citation in body into a numbered footnote reference and appends the matching footnote block.

Citations are numbered by first appearance, and a key cited more than once keeps its first number rather than claiming a second footnote. Citations written inside fenced code blocks or inline code spans are left exactly as they appear.

A body containing no citations is returned unchanged, byte for byte — no separator, no empty footnote block.

The returned string is Markdown with raw HTML embedded in it, not finished HTML: the caller still renders it. The emitted markup uses only <sup>, <a>, <hr>, <ol>, and <li> with id/href/class attributes. A default-policy ammonia clean keeps the elements and the ids but drops the classes — see CiteStyle.

style names the emitted classes and the back-link’s label; CiteStyle::default() is the plain choice.

§Errors

Returns CiteError::UnknownCitation on the first citation naming a key bibliography does not define.