Skip to main content

CiteStyle

Struct CiteStyle 

Source
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

Source

pub fn reference_class(self, class: impl Into<String>) -> Self

Sets the class on the <sup> wrapping each inline reference.

Source

pub fn separator_class(self, class: impl Into<String>) -> Self

Sets the class on the <hr> that opens the footnote block.

Source

pub fn list_class(self, class: impl Into<String>) -> Self

Sets the class on the <ol> holding the footnotes.

Source

pub fn item_class(self, class: impl Into<String>) -> Self

Sets the class on each footnote <li>.

Sets the class on the back-link closing each footnote.

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.

Trait Implementations§

Source§

impl Clone for CiteStyle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CiteStyle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CiteStyle

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for CiteStyle

Source§

impl PartialEq for CiteStyle

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CiteStyle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.