File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import re
6
6
from itertools import zip_longest
7
+ from typing import Iterable , Union
7
8
import mistletoe .block_tokenizer as tokenizer
8
9
from mistletoe import token , span_token
9
10
from mistletoe .core_tokens import (
@@ -136,7 +137,19 @@ class Document(BlockToken):
136
137
footnotes (dictionary): link reference definitions.
137
138
"""
138
139
139
- def __init__ (self , lines ):
140
+ def __init__ (self , lines : Union [str , Iterable [str ]]):
141
+ """
142
+ Instantiates this token and its content by parsing the input lines.
143
+
144
+ Args:
145
+ lines: input markdown to be tokenized. If a string is provided,
146
+ it will be split into lines.
147
+
148
+ CAUTION: If the input lines end with Windows line endings (``\\ r\\ n``),
149
+ the parsing process will not work correctly. For performance reasons,
150
+ clients need to normalize such line endings themselves, before passing
151
+ them to this function, e.g. by calling ``lines.replace('\\ r', '')``.
152
+ """
140
153
if isinstance (lines , str ):
141
154
lines = lines .splitlines (keepends = True )
142
155
lines = [line if line .endswith ('\n ' ) else '{}\n ' .format (line ) for line in lines ]
You can’t perform that action at this time.
0 commit comments