Skip to main content

Extension

Enum Extension 

Source
#[non_exhaustive]
pub enum Extension {
Show 77 variants Smart, Strikeout, Superscript, Subscript, PipeTables, Footnotes, TaskLists, Autolink, TexMathDollars, FencedDivs, BracketedSpans, HardLineBreaks, RawHtml, HeaderAttributes, FencedCodeAttributes, InlineCodeAttributes, LinkAttributes, Attributes, DefinitionLists, GridTables, MultilineTables, SimpleTables, TableCaptions, LineBlocks, FancyLists, ExampleLists, Startnum, YamlMetadataBlock, PandocTitleBlock, AutoIdentifiers, GfmAutoIdentifiers, AsciiIdentifiers, MmdHeaderIdentifiers, ImplicitHeaderReferences, ImplicitFigures, RawAttribute, InlineNotes, NativeDivs, NativeSpans, MarkdownInHtmlBlocks, MarkdownAttribute, RawTex, Citations, TableAttributes, BlankBeforeBlockquote, BlankBeforeHeader, Mark, Emoji, Alerts, TexMathSingleBackslash, TexMathDoubleBackslash, FencedCodeBlocks, BacktickCodeBlocks, TexMathGfm, EscapedLineBreaks, IntrawordUnderscores, ListsWithoutPrecedingBlankline, Abbreviations, AllSymbolsEscapable, AngleBracketsEscapable, EastAsianLineBreaks, FourSpaceRule, Gutenberg, IgnoreLineBreaks, LatexMacros, LiterateHaskell, MmdLinkAttributes, MmdTitleBlock, OldDashes, RawMarkdown, RebaseRelativePaths, ShortSubsuperscripts, ShortcutReferenceLinks, SpaceInAtxHeader, SpacedReferenceLinks, WikilinksTitleAfterPipe, WikilinksTitleBeforePipe,
}
Expand description

A single format extension. Each variant’s position in Extension::ALL is its bit index in Extensions.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Smart

Straight quotes, ..., --, and --- become curly quotes, an ellipsis, and en/em dashes.

§

Strikeout

~~text~~ strikeout spans.

§

Superscript

^text^ superscript spans.

§

Subscript

~text~ subscript spans.

§

PipeTables

Pipe tables: |-separated cells with a delimiter row carrying the column alignments.

§

Footnotes

[^label] footnote references with separately defined note bodies.

§

TaskLists

- [ ] / - [x] task-list items.

A bare absolute URI or www. address in running text becomes a link.

§

TexMathDollars

$…$ inline and $$…$$ display math.

§

FencedDivs

:::-fenced divs carrying an attribute block or a bare class name.

§

BracketedSpans

[text]{.class} spans: bracketed text followed by an attribute block.

§

HardLineBreaks

Every newline within a paragraph is a hard line break.

§

RawHtml

Raw HTML tags and blocks are carried through rather than treated as text.

§

HeaderAttributes

A {#id .class key=val} attribute block on a header line.

§

FencedCodeAttributes

An attribute block on a fenced code block’s opening line.

§

InlineCodeAttributes

An attribute block after an inline code span.

§

LinkAttributes

An attribute block after a link or image.

§

Attributes

The combined attribute toggle: the attribute syntaxes enabled as a group.

§

DefinitionLists

Definition lists: a term line followed by :-marked definition blocks.

§

GridTables

Grid tables drawn with +---+ cell borders.

§

MultilineTables

Multiline tables, whose cells may continue across several source lines.

§

SimpleTables

Simple tables: columns aligned under a dashed header line.

§

TableCaptions

A Table: (or bare :) caption line attached to a table.

§

LineBlocks

|-prefixed line blocks, preserving the source’s line divisions.

§

FancyLists

Ordered-list markers beyond decimal numbers: letters, roman numerals, and ) delimiters.

§

ExampleLists

(@label) example lists, numbered sequentially across the whole document.

§

Startnum

An ordered list starts at the number its first marker carries rather than 1.

§

YamlMetadataBlock

A ----delimited YAML metadata block.

§

PandocTitleBlock

A %-prefixed title/author/date block at the top of the document.

§

AutoIdentifiers

A header without an explicit identifier gets one derived from its text.

§

GfmAutoIdentifiers

Derived header identifiers use the GitHub slug form: lowercased, punctuation dropped, spaces to hyphens.

§

AsciiIdentifiers

Fold a derived identifier down to ASCII, dropping diacritics before the slug is formed.

§

MmdHeaderIdentifiers

A header’s explicit identifier is written in MultiMarkdown’s trailing [id] form rather than the {#id} attribute block.

§

ImplicitHeaderReferences

A header’s own text works as a reference-link label for that header.

§

ImplicitFigures

A bare image with a caption becomes a figure.

§

RawAttribute

Raw passthrough: `code`{=fmt} inline and ```{=fmt} fenced blocks.

§

InlineNotes

A ^[…] inline note expands to a footnote in place.

§

NativeDivs

A block-level <div> becomes a Div, with Markdown parsed inside.

§

NativeSpans

An inline <span> becomes a Span, with Markdown parsed inside.

§

MarkdownInHtmlBlocks

Markdown is parsed inside block-level HTML, which is otherwise split tag-by-tag.

§

MarkdownAttribute

A <div>/<span> emitted for a div/span carries a data-markdown="1" marker so its contents are still parsed as Markdown; this also forces a div with no native syntax into an HTML wrap.

§

RawTex

Inline raw TeX (\command{…}, \begin{env}…\end{env}) passes through verbatim.

§

Citations

[@key] / @key citation references.

§

TableAttributes

An attribute block on a table’s caption line attaches to the table.

§

BlankBeforeBlockquote

A blank line is required before a blockquote, so one never interrupts a paragraph.

§

BlankBeforeHeader

A blank line is required before a header, so one never interrupts a paragraph.

§

Mark

==text== highlight spans.

§

Emoji

:name: emoji shortcodes.

§

Alerts

> [!NOTE]-style admonition blockquotes become classed divs.

§

TexMathSingleBackslash

\(…\) inline and \[…\] display math delimiters.

§

TexMathDoubleBackslash

\\(…\\) inline and \\[…\\] display math delimiters.

§

FencedCodeBlocks

Tilde-fenced (~~~) code blocks; with no fence form available, code is written in the four-space indented form.

§

BacktickCodeBlocks

Backtick-fenced code blocks.

§

TexMathGfm

The GitHub math surface: inline $`…`$ and a ```math display block, as opposed to the $…$/$$…$$ dollar form.

§

EscapedLineBreaks

A backslash at a line’s end is a hard line break, written as a trailing \; without it the writer falls back to two trailing spaces.

§

IntrawordUnderscores

An underscore inside a word opens no emphasis, so the writer leaves intra-word _ literal; without it every _ is escaped so a strict reader cannot start emphasis mid-word.

§

ListsWithoutPrecedingBlankline

A list may begin directly after a paragraph line with no intervening blank line, interrupting it; without it a list marker on the line after a paragraph folds into that paragraph.

§

Abbreviations

*[SHY]: Soft hyphen abbreviation definitions, applied to later occurrences of the term.

§

AllSymbolsEscapable

A backslash escapes any symbol, not only the ASCII-punctuation subset.

§

AngleBracketsEscapable

A backslash before < or > escapes the angle bracket.

§

EastAsianLineBreaks

Line breaks between East Asian wide characters carry no width and are dropped.

§

FourSpaceRule

An indented code block requires four spaces of indentation rather than one tab stop.

§

Gutenberg

Typographic conventions of the Project Gutenberg style for plain-text output.

§

IgnoreLineBreaks

Soft line breaks within a paragraph are discarded rather than kept as spaces.

§

LatexMacros

User-defined LaTeX macros are expanded in math and raw TeX.

§

LiterateHaskell

Bird-track (> ) literate-program code sections.

§

MmdLinkAttributes

An attribute block following a link or image in the MultiMarkdown position.

§

MmdTitleBlock

A MultiMarkdown metadata block at the top of the document.

§

OldDashes

- and -- map to en/em dashes under the older dash convention.

§

RawMarkdown

A raw block or inline may be written directly as Markdown for round-tripping.

§

RebaseRelativePaths

Relative paths in links and images are rebased onto the source file’s location.

§

ShortSubsuperscripts

~x / ^x subscript and superscript bind only the single following character.

A defined label may be referenced by [label] alone, with no following [] or (…).

§

SpaceInAtxHeader

An ATX header requires a space between the opening # run and the heading text.

A reference link’s label and its following [id] may be separated by whitespace.

§

WikilinksTitleAfterPipe

[[target|title]] wiki links, with the title following the pipe.

§

WikilinksTitleBeforePipe

[[title|target]] wiki links, with the title preceding the pipe.

Implementations§

Source§

impl Extension

Source

pub const ALL: &'static [Extension]

Every extension, in declaration order.

Source

pub const COUNT: usize

The number of distinct extensions.

Source

pub const fn name(self) -> &'static str

The extension’s identifier (e.g. "footnotes").

Source

pub fn from_name(name: &str) -> Option<Extension>

The extension named name, or None if no extension uses that identifier.

Trait Implementations§

Source§

impl Clone for Extension

Source§

fn clone(&self) -> Extension

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 Copy for Extension

Source§

impl Debug for Extension

Source§

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

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

impl Eq for Extension

Source§

impl Hash for Extension

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Extension

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Extension

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.