pub struct CiteStyle { /* private fields */ }Expand description
How the emitted citation markup is labelled and named.
Structure is fixed — a <sup> reference per citation, an <hr>, an <ol> of
<li> footnotes, a back-link in each — and so are the fn-N/fnref-N ids the two
halves are wired together with. What this configures is the part a stylesheet
addresses: the class on each element, and the back-link’s label.
Defaults follow Pandoc’s names (footnote-ref, footnotes, footnote-back), so a
stylesheet written against Pandoc’s footnote output mostly applies unchanged.
Setting a class to "" emits that element with no class attribute at all, for
callers styling structurally (li[id^="fn-"]) rather than by class.
let style = mini_cite::CiteStyle::default()
.reference_class("citation-marker")
.backlink_label("↑");§Downstream sanitizing
These classes only reach the page if whatever renders the Markdown preserves
class. ammonia’s default policy strips it; mini-docs allowlists it from
0.5.0 on. Against an older or stricter sanitizer the markup still renders — the
ids survive — but the classes are dropped.
Implementations§
Source§impl CiteStyle
impl CiteStyle
Sourcepub fn reference_class(self, class: impl Into<String>) -> Self
pub fn reference_class(self, class: impl Into<String>) -> Self
Sets the class on the <sup> wrapping each inline reference.
Sourcepub fn separator_class(self, class: impl Into<String>) -> Self
pub fn separator_class(self, class: impl Into<String>) -> Self
Sets the class on the <hr> that opens the footnote block.
Sourcepub fn list_class(self, class: impl Into<String>) -> Self
pub fn list_class(self, class: impl Into<String>) -> Self
Sets the class on the <ol> holding the footnotes.
Sourcepub fn item_class(self, class: impl Into<String>) -> Self
pub fn item_class(self, class: impl Into<String>) -> Self
Sets the class on each footnote <li>.
Sourcepub fn backlink_class(self, class: impl Into<String>) -> Self
pub fn backlink_class(self, class: impl Into<String>) -> Self
Sets the class on the back-link closing each footnote.
Sourcepub fn backlink_label(self, label: impl Into<String>) -> Self
pub fn backlink_label(self, label: impl Into<String>) -> Self
Sets the back-link’s label — the glyph or word a reader clicks to return to the citation.
Written into the document verbatim, so markup here reaches the renderer as
markup and is subject to whatever sanitizing follows. An empty label leaves the
link with nothing to click; give it content, or draw one in CSS through
Self::backlink_class.