|
14 | 14 | * @typedef {ContainerDirective|LeafDirective|TextDirective} Directive
|
15 | 15 | */
|
16 | 16 |
|
17 |
| -import {decodeEntity} from 'parse-entities/decode-entity.js' |
| 17 | +import {parseEntities} from 'parse-entities' |
18 | 18 | import {stringifyEntitiesLight} from 'stringify-entities'
|
19 | 19 | import {visitParents} from 'unist-util-visit-parents'
|
20 | 20 | import {containerFlow} from 'mdast-util-to-markdown/lib/util/container-flow.js'
|
@@ -152,23 +152,23 @@ function exitAttributeIdValue(token) {
|
152 | 152 | const list = /** @type {Array.<[string, string]>} */ (
|
153 | 153 | this.getData('directiveAttributes')
|
154 | 154 | )
|
155 |
| - list.push(['id', decodeLight(this.sliceSerialize(token))]) |
| 155 | + list.push(['id', parseEntities(this.sliceSerialize(token))]) |
156 | 156 | }
|
157 | 157 |
|
158 | 158 | /** @type {FromMarkdownHandle} */
|
159 | 159 | function exitAttributeClassValue(token) {
|
160 | 160 | const list = /** @type {Array.<[string, string]>} */ (
|
161 | 161 | this.getData('directiveAttributes')
|
162 | 162 | )
|
163 |
| - list.push(['class', decodeLight(this.sliceSerialize(token))]) |
| 163 | + list.push(['class', parseEntities(this.sliceSerialize(token))]) |
164 | 164 | }
|
165 | 165 |
|
166 | 166 | /** @type {FromMarkdownHandle} */
|
167 | 167 | function exitAttributeValue(token) {
|
168 | 168 | const list = /** @type {Array.<[string, string]>} */ (
|
169 | 169 | this.getData('directiveAttributes')
|
170 | 170 | )
|
171 |
| - list[list.length - 1][1] = decodeLight(this.sliceSerialize(token)) |
| 171 | + list[list.length - 1][1] = parseEntities(this.sliceSerialize(token)) |
172 | 172 | }
|
173 | 173 |
|
174 | 174 | /** @type {FromMarkdownHandle} */
|
@@ -372,26 +372,6 @@ function inlineDirectiveLabel(node) {
|
372 | 372 | )
|
373 | 373 | }
|
374 | 374 |
|
375 |
| -/** |
376 |
| - * @param {string} value |
377 |
| - * @returns {string} |
378 |
| - */ |
379 |
| -function decodeLight(value) { |
380 |
| - return value.replace( |
381 |
| - /&(#(\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi, |
382 |
| - decodeIfPossible |
383 |
| - ) |
384 |
| -} |
385 |
| - |
386 |
| -/** |
387 |
| - * @param {string} $0 |
388 |
| - * @param {string} $1 |
389 |
| - * @returns {string} |
390 |
| - */ |
391 |
| -function decodeIfPossible($0, $1) { |
392 |
| - return decodeEntity($1) || $0 |
393 |
| -} |
394 |
| - |
395 | 375 | /**
|
396 | 376 | * @param {Directive} node
|
397 | 377 | * @returns {string}
|
|
0 commit comments