|
6 | 6 | from markdown_it.rules_inline import StateInline |
7 | 7 | from markdown_it.rules_block import StateBlock |
8 | 8 | from markdown_it.helpers import parseLinkLabel |
9 | | -from markdown_it.common.utils import isSpace, charCodeAt |
| 9 | +from markdown_it.common.utils import isSpace |
10 | 10 |
|
11 | 11 |
|
12 | 12 | def footnote_plugin(md: MarkdownIt): |
@@ -43,23 +43,23 @@ def footnote_def(state: StateBlock, startLine: int, endLine: int, silent: bool): |
43 | 43 | if start + 4 > maximum: |
44 | 44 | return False |
45 | 45 |
|
46 | | - if charCodeAt(state.src, start) != 0x5B: # /* [ */ |
| 46 | + if state.srcCharCode[start] != 0x5B: # /* [ */ |
47 | 47 | return False |
48 | | - if charCodeAt(state.src, start + 1) != 0x5E: # /* ^ */ |
| 48 | + if state.srcCharCode[start + 1] != 0x5E: # /* ^ */ |
49 | 49 | return False |
50 | 50 |
|
51 | 51 | pos = start + 2 |
52 | 52 | while pos < maximum: |
53 | | - if charCodeAt(state.src, pos) == 0x20: |
| 53 | + if state.srcCharCode[pos] == 0x20: |
54 | 54 | return False |
55 | | - if charCodeAt(state.src, pos) == 0x5D: # /* ] */ |
| 55 | + if state.srcCharCode[pos] == 0x5D: # /* ] */ |
56 | 56 | break |
57 | 57 | pos += 1 |
58 | 58 |
|
59 | 59 | if pos == start + 2: # no empty footnote labels |
60 | 60 | return False |
61 | 61 | pos += 1 |
62 | | - if pos + 1 >= maximum or charCodeAt(state.src, pos) != 0x3A: # /* : */ |
| 62 | + if pos + 1 >= maximum or state.srcCharCode[pos] != 0x3A: # /* : */ |
63 | 63 | return False |
64 | 64 | if silent: |
65 | 65 | return True |
@@ -87,7 +87,7 @@ def footnote_def(state: StateBlock, startLine: int, endLine: int, silent: bool): |
87 | 87 | ) |
88 | 88 |
|
89 | 89 | while pos < maximum: |
90 | | - ch = charCodeAt(state.src, pos) |
| 90 | + ch = state.srcCharCode[pos] |
91 | 91 |
|
92 | 92 | if isSpace(ch): |
93 | 93 | if ch == 0x09: |
@@ -136,9 +136,9 @@ def footnote_inline(state: StateInline, silent: bool): |
136 | 136 |
|
137 | 137 | if start + 2 >= maximum: |
138 | 138 | return False |
139 | | - if charCodeAt(state.src, start) != 0x5E: # /* ^ */ |
| 139 | + if state.srcCharCode[start] != 0x5E: # /* ^ */ |
140 | 140 | return False |
141 | | - if charCodeAt(state.src, start + 1) != 0x5B: # /* [ */ |
| 141 | + if state.srcCharCode[start + 1] != 0x5B: # /* [ */ |
142 | 142 | return False |
143 | 143 |
|
144 | 144 | labelStart = start + 2 |
@@ -182,18 +182,18 @@ def footnote_ref(state: StateInline, silent: bool): |
182 | 182 |
|
183 | 183 | if "footnotes" not in state.env or "refs" not in state.env["footnotes"]: |
184 | 184 | return False |
185 | | - if charCodeAt(state.src, start) != 0x5B: # /* [ */ |
| 185 | + if state.srcCharCode[start] != 0x5B: # /* [ */ |
186 | 186 | return False |
187 | | - if charCodeAt(state.src, start + 1) != 0x5E: # /* ^ */ |
| 187 | + if state.srcCharCode[start + 1] != 0x5E: # /* ^ */ |
188 | 188 | return False |
189 | 189 |
|
190 | 190 | pos = start + 2 |
191 | 191 | while pos < maximum: |
192 | | - if charCodeAt(state.src, pos) == 0x20: |
| 192 | + if state.srcCharCode[pos] == 0x20: |
193 | 193 | return False |
194 | | - if charCodeAt(state.src, pos) == 0x0A: |
| 194 | + if state.srcCharCode[pos] == 0x0A: |
195 | 195 | return False |
196 | | - if charCodeAt(state.src, pos) == 0x5D: # /* ] */ |
| 196 | + if state.srcCharCode[pos] == 0x5D: # /* ] */ |
197 | 197 | break |
198 | 198 | pos += 1 |
199 | 199 |
|
|
0 commit comments