markdown_it.common.utils module¶
Utilities for parsing source text
-
markdown_it.common.utils.
arrayReplaceAt
(src: list, pos: int, newElements: list) → list[source]¶ Remove element from array and put another array at those position. Useful for some operations with tokens
-
markdown_it.common.utils.
charCodeAt
(src: str, pos: int) → Any[source]¶ Returns the Unicode value of the character at the specified location.
@param - index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.
This was added for compatibility with python
-
markdown_it.common.utils.
fromCodePoint
(c: int) → str[source]¶ Convert ordinal to unicode.
Note, in the original Javascript two string characters were required, for codepoints larger than 0xFFFF. But Python 3 can represent any unicode codepoint in one character.
-
markdown_it.common.utils.
isMdAsciiPunct
(ch: int) → bool[source]¶ Markdown ASCII punctuation characters.
!, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
See http://spec.commonmark.org/0.15/#ascii-punctuation-character
Don’t confuse with unicode punctuation !!! It lacks some chars in ascii range.
-
markdown_it.common.utils.
normalizeReference
(string: str) → str[source]¶ Helper to unify [reference labels].