These span tokens are defined in the CommonMark specification.
This is a special token that runs a nested parse of the inline string and extracts nested tokens.
mistletoe.span_tokens.
CoreTokens
Bases: mistletoe.base_elements.SpanToken
mistletoe.base_elements.SpanToken
read
Take a pattern match and return the instatiated token.
find
Find all tokens, matching a pattern in the given string
Strong
Strong tokens: **some text** or __some text__, read in CoreTokens.read
content – raw string content of the token
children – list of child tokens
Emphasis
Emphasis tokens *some text* or _some text_, read in CoreTokens.read
InlineCode
Inline code tokens: `some code`, read in CoreTokens.read
children (list) – a single RawText node for alternative text.
position (Tuple[int, int]) – Line position in source text (start, end) (default: None)
Image
Image tokens, with inline targets: “![alt](src “title”)”, read in CoreTokens.read
src (str) – image source
title (str) – image title (default: None)
children (list) – alternative text. (default: Factory(factory=<class ‘list’>, takes_self=False))
Link
Link tokens, with inline targets: “[name](target)”, read in CoreTokens.read
target (str) – link target
title (str) – link title (default: None)
children (list) – link text. (default: Factory(factory=<class ‘list’>, takes_self=False))
AutoLink
Autolink tokens. (“<http://www.google.com>”)
mailto (bool) – if the link is an email
EscapeSequence
Escape sequences. (“\*”)
This should be set first in the token parse list.
LineBreak
Hard or soft line breaks.
content (bool) – raw content. (default: “”)
soft (bool) – if the break is soft or hard.
RawText
Raw text. A leaf node.
RawText is the only token that accepts a string for its read method, instead of a match object. Also, all recursions should bottom out here.
content (bool) – raw string content of the token
HTMLSpan
Span-level HTML tokens.