Skip to main content

ParserArgs

Struct ParserArgs 

Source
pub struct ParserArgs {
    pub file: Option<String>,
    pub slots: bool,
    pub location: bool,
    pub conditional_tags: Option<Vec<String>>,
    pub parse_frontmatter: bool,
    pub strip_bom: bool,
    pub spans: bool,
}
Expand description

Upstream’s ParserArgs (types.ts): {file?, slots?, location?, conditionalTags?}, and three switches of this crate’s, off by default.

Fields§

§file: Option<String>

location.file of every node.

§slots: bool

Put {% slot "name" %} tags in their parent’s slots instead of its children.

§location: bool

Give nodes lines and location (upstream: unless location: false).

§conditional_tags: Option<Vec<String>>

The tags the table transform keeps as row wrappers; None is upstream’s default, ['if'].

§parse_frontmatter: bool

This crate’s: the document’s frontmatter attribute is the YAML parsed into an object (see the module’s documentation). Off: upstream’s raw text.

§strip_bom: bool

This crate’s: crate::next::index::parse does not tokenize a byte-order mark that starts the text (upstream does, so a heading on line 1 is then a paragraph). The parser takes tokens as they are and ignores it.

§spans: bool

This crate’s: give nodes and the parser’s errors this crate’s own positions, Node::span and ValidationError::span (1-based line, UTF-16 column and byte offset at each end; see the module’s documentation), which validate() passes on as crate::validator::ValidateError::span. Off by default, as upstream has none: the parser then does none of their work (about half of a parse) and every span is None. A tool that reports positions (a linter, a language server) turns it on. Needs location: with location: false nothing has a span.

Implementations§

Source§

impl ParserArgs

Source

pub fn file(file: impl Into<String>) -> Self

parser(tokens, 'file.md'): a file name alone.

Trait Implementations§

Source§

impl Clone for ParserArgs

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 ParserArgs

Source§

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

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

impl Default for ParserArgs

Source§

fn default() -> Self

parser(tokens): no file, no slots, locations on, conditionalTags defaulted; this crate’s switches off (no spans).

Source§

impl PartialEq for ParserArgs

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 ParserArgs

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.