markdown_it.common.utils module¶
Utilities for parsing source text
- markdown_it.common.utils.arrayReplaceAt(src: list, pos: int, newElements: list) list [源代码]¶
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 [源代码]¶
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 [源代码]¶
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 [源代码]¶
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 [源代码]¶
Helper to unify [reference labels].