@limetech/lime-elements 40.5.2 → 40.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/cjs/{_baseEach-Bygi-un6.js → _baseForOwn-8jMPwf3X.js} +1 -43
- package/dist/cjs/{_baseIsEqual-CQZKiKbe.js → _baseIsEqual-zzV9DKMv.js} +0 -1
- package/dist/cjs/{_baseIteratee-DDklwtn9.js → _baseIteratee-BIMRm4nq.js} +1 -3
- package/dist/cjs/_baseSet-DykMx7uF.js +92 -0
- package/dist/cjs/_getPrototype-CCLHkBHj.js +8 -0
- package/dist/cjs/{cloneDeep-hE40Q8aw.js → cloneDeep-D2immmwT.js} +16 -160
- package/dist/cjs/{index-ETPz91V5.js → index-zZvs6xK-.js} +9382 -9504
- package/dist/cjs/{difference-B543MGsY.js → isArrayLikeObject-U2Ddbw4n.js} +5 -93
- package/dist/cjs/{isEqual-Cd9J8a5-.js → isEqual-D3eFkhqd.js} +1 -1
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-action-bar_3.cjs.entry.js +1 -1
- package/dist/cjs/limel-chip-set.cjs.entry.js +2 -2
- package/dist/cjs/limel-dialog.cjs.entry.js +2 -2
- package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +45 -6
- package/dist/cjs/limel-file-viewer.cjs.entry.js +511 -71
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +73 -11
- package/dist/cjs/limel-form.cjs.entry.js +1857 -1919
- package/dist/cjs/limel-markdown.cjs.entry.js +28 -4
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +328 -264
- package/dist/cjs/limel-tab-bar.cjs.entry.js +83 -4
- package/dist/cjs/limel-table.cjs.entry.js +598 -199
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/markdown-exporter-9p7d3Q76.js +6210 -0
- package/dist/cjs/{markdown-parser-YH5HSSgF.js → markdown-parser-Cgv5Y9Z4.js} +579 -848
- package/dist/collection/components/action-bar/action-bar-item/action-bar-item.css +1 -1
- package/dist/collection/components/form/fields/schema-field.js +8 -0
- package/dist/collection/components/form/form.js +1 -0
- package/dist/collection/components/form/form.test-schemas.js +47 -0
- package/dist/collection/components/form/templates/array-field-collapsible-item.js +38 -11
- package/dist/collection/components/markdown/markdown-exporter.js +186 -0
- package/dist/collection/components/markdown/markdown-parser.js +2 -3
- package/dist/collection/components/markdown/markdown.js +54 -2
- package/dist/collection/components/table/table.css +1 -2
- package/dist/esm/{_baseEach-lvj-g1Zj.js → _baseForOwn-D5j7fHlv.js} +2 -42
- package/dist/esm/{_baseIsEqual-B6bIeexY.js → _baseIsEqual-CyF4P8uM.js} +2 -2
- package/dist/esm/{_baseIteratee-CEZRuq23.js → _baseIteratee-CpbczHY1.js} +3 -3
- package/dist/esm/_baseSet-Cw2IE6ZF.js +89 -0
- package/dist/esm/_getPrototype-B0kMNv1F.js +6 -0
- package/dist/esm/{_getTag-CMJL-6hk.js → _getTag-BiAaLWvH.js} +1 -1
- package/dist/esm/{cloneDeep-CL7UD3mR.js → cloneDeep-DAbOtbs8.js} +18 -154
- package/dist/esm/{index-CbciMfiU.js → index-BN64nlbO.js} +9369 -9505
- package/dist/esm/{difference-DND5tWiA.js → isArrayLikeObject-CJB8HbtH.js} +7 -91
- package/dist/esm/{isEmpty-DHgukT5k.js → isEmpty-BGVZ12Ea.js} +1 -1
- package/dist/esm/{isEqual-4tbMaaf_.js → isEqual-CE83yS8T.js} +1 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-action-bar_3.entry.js +1 -1
- package/dist/esm/limel-chip-set.entry.js +3 -3
- package/dist/esm/limel-chip_2.entry.js +2 -2
- package/dist/esm/limel-dialog.entry.js +3 -3
- package/dist/esm/limel-file-dropzone_2.entry.js +45 -6
- package/dist/esm/limel-file-viewer.entry.js +511 -71
- package/dist/esm/limel-flatpickr-adapter.entry.js +69 -7
- package/dist/esm/limel-form.entry.js +1854 -1916
- package/dist/esm/limel-markdown.entry.js +28 -4
- package/dist/esm/limel-prosemirror-adapter.entry.js +329 -265
- package/dist/esm/limel-tab-bar.entry.js +83 -4
- package/dist/esm/limel-table.entry.js +595 -196
- package/dist/esm/loader.js +1 -1
- package/dist/esm/markdown-exporter--3_MaqwD.js +6208 -0
- package/dist/esm/{markdown-parser-DrxxGLF5.js → markdown-parser-DCf-3dKZ.js} +506 -791
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-0fba64eb.entry.js +16 -0
- package/dist/lime-elements/p-19344984.entry.js +13 -0
- package/dist/lime-elements/p-20658306.entry.js +1 -0
- package/dist/lime-elements/p-26c5c6b9.entry.js +1 -0
- package/dist/lime-elements/{p-11a96a8c.entry.js → p-36ce4fbc.entry.js} +1 -1
- package/dist/lime-elements/{p-955292eb.entry.js → p-4aae63bd.entry.js} +1 -1
- package/dist/lime-elements/{p-b8c76487.entry.js → p-5d974afa.entry.js} +1 -1
- package/dist/lime-elements/p-B6-3WXAv.js +1 -0
- package/dist/lime-elements/p-BPzhuHcl.js +1 -0
- package/dist/lime-elements/p-BQeIv4aA.js +1 -0
- package/dist/lime-elements/p-BY5NjPj8.js +1 -0
- package/dist/lime-elements/p-CC4Usa-Q.js +7 -0
- package/dist/lime-elements/p-COdirXg1.js +1 -0
- package/dist/lime-elements/p-CW2-jhzP.js +1 -0
- package/dist/lime-elements/p-D2VFSWDU.js +1 -0
- package/dist/lime-elements/{p-D4RdItCq.js → p-DK0pjX-Y.js} +1 -1
- package/dist/lime-elements/p-ORUNaKm-.js +1 -0
- package/dist/lime-elements/p-_UXAljNc.js +1 -0
- package/dist/lime-elements/{p-5b371d6b.entry.js → p-a71f6e87.entry.js} +4 -4
- package/dist/lime-elements/p-cef66e53.entry.js +1 -0
- package/dist/lime-elements/{p-02812dc8.entry.js → p-d3bd4b80.entry.js} +1 -1
- package/dist/lime-elements/p-dc9cd793.entry.js +1 -0
- package/dist/lime-elements/p-dd62042a.entry.js +1 -0
- package/dist/lime-elements/p-nVemxylR.js +1 -0
- package/dist/lime-elements/p-pk5KIdKH.js +1 -0
- package/dist/types/components/form/form.test-schemas.d.ts +3 -0
- package/dist/types/components/form/templates/array-field-collapsible-item.d.ts +0 -1
- package/dist/types/components/markdown/markdown-exporter.d.ts +15 -0
- package/dist/types/components/markdown/markdown.d.ts +19 -0
- package/dist/types/components.d.ts +10 -0
- package/dist/types/global/shared-types/custom-element.types.d.ts +25 -0
- package/package.json +17 -11
- package/dist/cjs/_getAllKeysIn-BJsgUTAt.js +0 -119
- package/dist/cjs/_isIterateeCall-BUGt9SrH.js +0 -73
- package/dist/cjs/pickBy-D-X6S5kg.js +0 -201
- package/dist/esm/_getAllKeysIn-kT3KizYN.js +0 -114
- package/dist/esm/_isIterateeCall-Bb4gUZLK.js +0 -70
- package/dist/esm/pickBy-C4C3CM4m.js +0 -195
- package/dist/lime-elements/p-1e085bbe.entry.js +0 -13
- package/dist/lime-elements/p-56bkn1D-.js +0 -1
- package/dist/lime-elements/p-67f02b69.entry.js +0 -1
- package/dist/lime-elements/p-6d5b23ad.entry.js +0 -1
- package/dist/lime-elements/p-867681aa.entry.js +0 -1
- package/dist/lime-elements/p-9d3437ac.entry.js +0 -16
- package/dist/lime-elements/p-B8yl2MCT.js +0 -1
- package/dist/lime-elements/p-BAR6am-7.js +0 -1
- package/dist/lime-elements/p-BE1Efiuj.js +0 -1
- package/dist/lime-elements/p-BsX7ma3n.js +0 -1
- package/dist/lime-elements/p-C9xHOCE_.js +0 -7
- package/dist/lime-elements/p-CR7u-m0b.js +0 -1
- package/dist/lime-elements/p-CVzgpz9P.js +0 -1
- package/dist/lime-elements/p-D8H5afYg.js +0 -1
- package/dist/lime-elements/p-DMNtoJ8I.js +0 -1
- package/dist/lime-elements/p-DtrvybFR.js +0 -1
- package/dist/lime-elements/p-f309ceb8.entry.js +0 -1
- package/dist/lime-elements/p-f3c108c9.entry.js +0 -1
- package/dist/lime-elements/p-mmkVLOjW.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-B85MJLTf.js';
|
|
2
|
-
import { s as structuredClone, v as visit,
|
|
2
|
+
import { s as stringifyPosition, p as pointStart, f as pointEnd, g as structuredClone, v as visit, h as position$1, i as convert, j as visitParents, k as ccount, E as EXIT, l as parseSelector, m as parse$1, n as parse$2, w as webNamespaces, z as zwitch, o as stringify, q as stringify$1, t as determineBranch, x as htmlDecodeTree, B as BinTrieFlags, u as unified, a as rehypeSanitize, b as rehypeStringify, r as rehypeParse, d as defaultSchema } from './index-BN64nlbO.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
@@ -3461,7 +3461,7 @@ function resolveAll(constructs, events, context) {
|
|
|
3461
3461
|
*/
|
|
3462
3462
|
|
|
3463
3463
|
/** @type {Construct} */
|
|
3464
|
-
const attention = {
|
|
3464
|
+
const attention$2 = {
|
|
3465
3465
|
name: 'attention',
|
|
3466
3466
|
tokenize: tokenizeAttention,
|
|
3467
3467
|
resolveAll: resolveAllAttention
|
|
@@ -10690,18 +10690,18 @@ const text$5 = {
|
|
|
10690
10690
|
[-3]: lineEnding,
|
|
10691
10691
|
[33]: labelStartImage,
|
|
10692
10692
|
[38]: characterReference,
|
|
10693
|
-
[42]: attention,
|
|
10693
|
+
[42]: attention$2,
|
|
10694
10694
|
[60]: [autolink, htmlText],
|
|
10695
10695
|
[91]: labelStartLink,
|
|
10696
10696
|
[92]: [hardBreakEscape, characterEscape],
|
|
10697
10697
|
[93]: labelEnd,
|
|
10698
|
-
[95]: attention,
|
|
10698
|
+
[95]: attention$2,
|
|
10699
10699
|
[96]: codeText
|
|
10700
10700
|
};
|
|
10701
10701
|
|
|
10702
10702
|
/** @satisfies {Extension['insideSpan']} */
|
|
10703
10703
|
const insideSpan = {
|
|
10704
|
-
null: [attention, resolver]
|
|
10704
|
+
null: [attention$2, resolver]
|
|
10705
10705
|
};
|
|
10706
10706
|
|
|
10707
10707
|
/** @satisfies {Extension['attentionMarkers']} */
|
|
@@ -10740,7 +10740,7 @@ var defaultConstructs = /*#__PURE__*/Object.freeze({
|
|
|
10740
10740
|
* @param {ParseOptions | null | undefined} [options]
|
|
10741
10741
|
* @returns {ParseContext}
|
|
10742
10742
|
*/
|
|
10743
|
-
function parse
|
|
10743
|
+
function parse(options) {
|
|
10744
10744
|
const settings = options || {};
|
|
10745
10745
|
const constructs =
|
|
10746
10746
|
/** @type {FullNormalizedExtension} */
|
|
@@ -10802,7 +10802,7 @@ function postprocess(events) {
|
|
|
10802
10802
|
* @returns {Array<Chunk>}
|
|
10803
10803
|
*/
|
|
10804
10804
|
|
|
10805
|
-
const search$
|
|
10805
|
+
const search$1 = /[\0\t\n\r]/g;
|
|
10806
10806
|
|
|
10807
10807
|
/**
|
|
10808
10808
|
* @returns {Preprocessor}
|
|
@@ -10846,8 +10846,8 @@ function preprocess() {
|
|
|
10846
10846
|
start = undefined;
|
|
10847
10847
|
}
|
|
10848
10848
|
while (startPosition < value.length) {
|
|
10849
|
-
search$
|
|
10850
|
-
match = search$
|
|
10849
|
+
search$1.lastIndex = startPosition;
|
|
10850
|
+
match = search$1.exec(value);
|
|
10851
10851
|
endPosition =
|
|
10852
10852
|
match && match.index !== undefined ? match.index : value.length;
|
|
10853
10853
|
code = value.charCodeAt(endPosition);
|
|
@@ -10942,91 +10942,6 @@ function decode($0, $1, $2) {
|
|
|
10942
10942
|
return decodeNamedCharacterReference($2) || $0
|
|
10943
10943
|
}
|
|
10944
10944
|
|
|
10945
|
-
/**
|
|
10946
|
-
* @typedef {import('unist').Node} Node
|
|
10947
|
-
* @typedef {import('unist').Point} Point
|
|
10948
|
-
* @typedef {import('unist').Position} Position
|
|
10949
|
-
*/
|
|
10950
|
-
|
|
10951
|
-
/**
|
|
10952
|
-
* @typedef NodeLike
|
|
10953
|
-
* @property {string} type
|
|
10954
|
-
* @property {PositionLike | null | undefined} [position]
|
|
10955
|
-
*
|
|
10956
|
-
* @typedef PointLike
|
|
10957
|
-
* @property {number | null | undefined} [line]
|
|
10958
|
-
* @property {number | null | undefined} [column]
|
|
10959
|
-
* @property {number | null | undefined} [offset]
|
|
10960
|
-
*
|
|
10961
|
-
* @typedef PositionLike
|
|
10962
|
-
* @property {PointLike | null | undefined} [start]
|
|
10963
|
-
* @property {PointLike | null | undefined} [end]
|
|
10964
|
-
*/
|
|
10965
|
-
|
|
10966
|
-
/**
|
|
10967
|
-
* Serialize the positional info of a point, position (start and end points),
|
|
10968
|
-
* or node.
|
|
10969
|
-
*
|
|
10970
|
-
* @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value]
|
|
10971
|
-
* Node, position, or point.
|
|
10972
|
-
* @returns {string}
|
|
10973
|
-
* Pretty printed positional info of a node (`string`).
|
|
10974
|
-
*
|
|
10975
|
-
* In the format of a range `ls:cs-le:ce` (when given `node` or `position`)
|
|
10976
|
-
* or a point `l:c` (when given `point`), where `l` stands for line, `c` for
|
|
10977
|
-
* column, `s` for `start`, and `e` for end.
|
|
10978
|
-
* An empty string (`''`) is returned if the given value is neither `node`,
|
|
10979
|
-
* `position`, nor `point`.
|
|
10980
|
-
*/
|
|
10981
|
-
function stringifyPosition(value) {
|
|
10982
|
-
// Nothing.
|
|
10983
|
-
if (!value || typeof value !== 'object') {
|
|
10984
|
-
return ''
|
|
10985
|
-
}
|
|
10986
|
-
|
|
10987
|
-
// Node.
|
|
10988
|
-
if ('position' in value || 'type' in value) {
|
|
10989
|
-
return position$2(value.position)
|
|
10990
|
-
}
|
|
10991
|
-
|
|
10992
|
-
// Position.
|
|
10993
|
-
if ('start' in value || 'end' in value) {
|
|
10994
|
-
return position$2(value)
|
|
10995
|
-
}
|
|
10996
|
-
|
|
10997
|
-
// Point.
|
|
10998
|
-
if ('line' in value || 'column' in value) {
|
|
10999
|
-
return point$4(value)
|
|
11000
|
-
}
|
|
11001
|
-
|
|
11002
|
-
// ?
|
|
11003
|
-
return ''
|
|
11004
|
-
}
|
|
11005
|
-
|
|
11006
|
-
/**
|
|
11007
|
-
* @param {Point | PointLike | null | undefined} point
|
|
11008
|
-
* @returns {string}
|
|
11009
|
-
*/
|
|
11010
|
-
function point$4(point) {
|
|
11011
|
-
return index$1(point && point.line) + ':' + index$1(point && point.column)
|
|
11012
|
-
}
|
|
11013
|
-
|
|
11014
|
-
/**
|
|
11015
|
-
* @param {Position | PositionLike | null | undefined} pos
|
|
11016
|
-
* @returns {string}
|
|
11017
|
-
*/
|
|
11018
|
-
function position$2(pos) {
|
|
11019
|
-
return point$4(pos && pos.start) + '-' + point$4(pos && pos.end)
|
|
11020
|
-
}
|
|
11021
|
-
|
|
11022
|
-
/**
|
|
11023
|
-
* @param {number | null | undefined} value
|
|
11024
|
-
* @returns {number}
|
|
11025
|
-
*/
|
|
11026
|
-
function index$1(value) {
|
|
11027
|
-
return value && typeof value === 'number' ? value : 1
|
|
11028
|
-
}
|
|
11029
|
-
|
|
11030
10945
|
/**
|
|
11031
10946
|
* @typedef {import('mdast').Break} Break
|
|
11032
10947
|
* @typedef {import('mdast').Blockquote} Blockquote
|
|
@@ -11094,7 +11009,7 @@ function fromMarkdown(value, encoding, options) {
|
|
|
11094
11009
|
}
|
|
11095
11010
|
return compiler(options)(
|
|
11096
11011
|
postprocess(
|
|
11097
|
-
parse
|
|
11012
|
+
parse(options).document().write(preprocess()(value, encoding, true))
|
|
11098
11013
|
)
|
|
11099
11014
|
)
|
|
11100
11015
|
}
|
|
@@ -11277,7 +11192,7 @@ function compiler(options) {
|
|
|
11277
11192
|
|
|
11278
11193
|
// Figure out `root` position.
|
|
11279
11194
|
tree.position = {
|
|
11280
|
-
start: point$
|
|
11195
|
+
start: point$1(
|
|
11281
11196
|
events.length > 0
|
|
11282
11197
|
? events[0][1].start
|
|
11283
11198
|
: {
|
|
@@ -11286,7 +11201,7 @@ function compiler(options) {
|
|
|
11286
11201
|
offset: 0
|
|
11287
11202
|
}
|
|
11288
11203
|
),
|
|
11289
|
-
end: point$
|
|
11204
|
+
end: point$1(
|
|
11290
11205
|
events.length > 0
|
|
11291
11206
|
? events[events.length - 2][1].end
|
|
11292
11207
|
: {
|
|
@@ -11494,7 +11409,7 @@ function compiler(options) {
|
|
|
11494
11409
|
this.stack.push(node);
|
|
11495
11410
|
this.tokenStack.push([token, errorHandler]);
|
|
11496
11411
|
node.position = {
|
|
11497
|
-
start: point$
|
|
11412
|
+
start: point$1(token.start),
|
|
11498
11413
|
// @ts-expect-error: `end` will be patched later.
|
|
11499
11414
|
end: undefined
|
|
11500
11415
|
};
|
|
@@ -11554,7 +11469,7 @@ function compiler(options) {
|
|
|
11554
11469
|
handler.call(this, token, open[0]);
|
|
11555
11470
|
}
|
|
11556
11471
|
}
|
|
11557
|
-
node.position.end = point$
|
|
11472
|
+
node.position.end = point$1(token.end);
|
|
11558
11473
|
}
|
|
11559
11474
|
|
|
11560
11475
|
/**
|
|
@@ -11725,7 +11640,7 @@ function compiler(options) {
|
|
|
11725
11640
|
// Add a new text node.
|
|
11726
11641
|
tail = text();
|
|
11727
11642
|
tail.position = {
|
|
11728
|
-
start: point$
|
|
11643
|
+
start: point$1(token.start),
|
|
11729
11644
|
// @ts-expect-error: we’ll add `end` later.
|
|
11730
11645
|
end: undefined
|
|
11731
11646
|
};
|
|
@@ -11742,7 +11657,7 @@ function compiler(options) {
|
|
|
11742
11657
|
function onexitdata(token) {
|
|
11743
11658
|
const tail = this.stack.pop();
|
|
11744
11659
|
tail.value += this.sliceSerialize(token);
|
|
11745
|
-
tail.position.end = point$
|
|
11660
|
+
tail.position.end = point$1(token.end);
|
|
11746
11661
|
}
|
|
11747
11662
|
|
|
11748
11663
|
/**
|
|
@@ -11755,7 +11670,7 @@ function compiler(options) {
|
|
|
11755
11670
|
// If we’re at a hard break, include the line ending in there.
|
|
11756
11671
|
if (this.data.atHardBreak) {
|
|
11757
11672
|
const tail = context.children[context.children.length - 1];
|
|
11758
|
-
tail.position.end = point$
|
|
11673
|
+
tail.position.end = point$1(token.end);
|
|
11759
11674
|
this.data.atHardBreak = undefined;
|
|
11760
11675
|
return
|
|
11761
11676
|
}
|
|
@@ -11989,7 +11904,7 @@ function compiler(options) {
|
|
|
11989
11904
|
}
|
|
11990
11905
|
const tail = this.stack.pop();
|
|
11991
11906
|
tail.value += value;
|
|
11992
|
-
tail.position.end = point$
|
|
11907
|
+
tail.position.end = point$1(token.end);
|
|
11993
11908
|
}
|
|
11994
11909
|
|
|
11995
11910
|
/**
|
|
@@ -12173,7 +12088,7 @@ function compiler(options) {
|
|
|
12173
12088
|
* @returns {Point}
|
|
12174
12089
|
* unist point.
|
|
12175
12090
|
*/
|
|
12176
|
-
function point$
|
|
12091
|
+
function point$1(d) {
|
|
12177
12092
|
return {
|
|
12178
12093
|
line: d.line,
|
|
12179
12094
|
column: d.column,
|
|
@@ -13080,102 +12995,6 @@ function strong$1(state, node) {
|
|
|
13080
12995
|
return state.applyData(node, result)
|
|
13081
12996
|
}
|
|
13082
12997
|
|
|
13083
|
-
/**
|
|
13084
|
-
* @typedef {import('unist').Node} Node
|
|
13085
|
-
* @typedef {import('unist').Point} Point
|
|
13086
|
-
* @typedef {import('unist').Position} Position
|
|
13087
|
-
*/
|
|
13088
|
-
|
|
13089
|
-
/**
|
|
13090
|
-
* @typedef NodeLike
|
|
13091
|
-
* @property {string} type
|
|
13092
|
-
* @property {PositionLike | null | undefined} [position]
|
|
13093
|
-
*
|
|
13094
|
-
* @typedef PositionLike
|
|
13095
|
-
* @property {PointLike | null | undefined} [start]
|
|
13096
|
-
* @property {PointLike | null | undefined} [end]
|
|
13097
|
-
*
|
|
13098
|
-
* @typedef PointLike
|
|
13099
|
-
* @property {number | null | undefined} [line]
|
|
13100
|
-
* @property {number | null | undefined} [column]
|
|
13101
|
-
* @property {number | null | undefined} [offset]
|
|
13102
|
-
*/
|
|
13103
|
-
|
|
13104
|
-
/**
|
|
13105
|
-
* Get the ending point of `node`.
|
|
13106
|
-
*
|
|
13107
|
-
* @param node
|
|
13108
|
-
* Node.
|
|
13109
|
-
* @returns
|
|
13110
|
-
* Point.
|
|
13111
|
-
*/
|
|
13112
|
-
const pointEnd$1 = point$2('end');
|
|
13113
|
-
|
|
13114
|
-
/**
|
|
13115
|
-
* Get the starting point of `node`.
|
|
13116
|
-
*
|
|
13117
|
-
* @param node
|
|
13118
|
-
* Node.
|
|
13119
|
-
* @returns
|
|
13120
|
-
* Point.
|
|
13121
|
-
*/
|
|
13122
|
-
const pointStart$1 = point$2('start');
|
|
13123
|
-
|
|
13124
|
-
/**
|
|
13125
|
-
* Get the positional info of `node`.
|
|
13126
|
-
*
|
|
13127
|
-
* @param {'end' | 'start'} type
|
|
13128
|
-
* Side.
|
|
13129
|
-
* @returns
|
|
13130
|
-
* Getter.
|
|
13131
|
-
*/
|
|
13132
|
-
function point$2(type) {
|
|
13133
|
-
return point
|
|
13134
|
-
|
|
13135
|
-
/**
|
|
13136
|
-
* Get the point info of `node` at a bound side.
|
|
13137
|
-
*
|
|
13138
|
-
* @param {Node | NodeLike | null | undefined} [node]
|
|
13139
|
-
* @returns {Point | undefined}
|
|
13140
|
-
*/
|
|
13141
|
-
function point(node) {
|
|
13142
|
-
const point = (node && node.position && node.position[type]) || {};
|
|
13143
|
-
|
|
13144
|
-
if (
|
|
13145
|
-
typeof point.line === 'number' &&
|
|
13146
|
-
point.line > 0 &&
|
|
13147
|
-
typeof point.column === 'number' &&
|
|
13148
|
-
point.column > 0
|
|
13149
|
-
) {
|
|
13150
|
-
return {
|
|
13151
|
-
line: point.line,
|
|
13152
|
-
column: point.column,
|
|
13153
|
-
offset:
|
|
13154
|
-
typeof point.offset === 'number' && point.offset > -1
|
|
13155
|
-
? point.offset
|
|
13156
|
-
: undefined
|
|
13157
|
-
}
|
|
13158
|
-
}
|
|
13159
|
-
}
|
|
13160
|
-
}
|
|
13161
|
-
|
|
13162
|
-
/**
|
|
13163
|
-
* Get the positional info of `node`.
|
|
13164
|
-
*
|
|
13165
|
-
* @param {Node | NodeLike | null | undefined} [node]
|
|
13166
|
-
* Node.
|
|
13167
|
-
* @returns {Position | undefined}
|
|
13168
|
-
* Position.
|
|
13169
|
-
*/
|
|
13170
|
-
function position$1(node) {
|
|
13171
|
-
const start = pointStart$1(node);
|
|
13172
|
-
const end = pointEnd$1(node);
|
|
13173
|
-
|
|
13174
|
-
if (start && end) {
|
|
13175
|
-
return {start, end}
|
|
13176
|
-
}
|
|
13177
|
-
}
|
|
13178
|
-
|
|
13179
12998
|
/**
|
|
13180
12999
|
* @import {Table} from 'mdast'
|
|
13181
13000
|
* @import {Element} from 'hast'
|
|
@@ -13220,8 +13039,8 @@ function table(state, node) {
|
|
|
13220
13039
|
children: state.wrap(rows, true)
|
|
13221
13040
|
};
|
|
13222
13041
|
|
|
13223
|
-
const start = pointStart
|
|
13224
|
-
const end = pointEnd
|
|
13042
|
+
const start = pointStart(node.children[1]);
|
|
13043
|
+
const end = pointEnd(node.children[node.children.length - 1]);
|
|
13225
13044
|
if (start && end) body.position = {start, end};
|
|
13226
13045
|
tableContent.push(body);
|
|
13227
13046
|
}
|
|
@@ -15446,17 +15265,59 @@ function toAlignment(value) {
|
|
|
15446
15265
|
: 0
|
|
15447
15266
|
}
|
|
15448
15267
|
|
|
15268
|
+
/**
|
|
15269
|
+
* @typedef {import('mdast').PhrasingContent} PhrasingContent
|
|
15270
|
+
*/
|
|
15271
|
+
|
|
15272
|
+
|
|
15273
|
+
/**
|
|
15274
|
+
* Check if the given value is *phrasing content*.
|
|
15275
|
+
*
|
|
15276
|
+
* > 👉 **Note**: Excludes `html`, which can be both phrasing or flow.
|
|
15277
|
+
*
|
|
15278
|
+
* @param node
|
|
15279
|
+
* Thing to check, typically `Node`.
|
|
15280
|
+
* @returns
|
|
15281
|
+
* Whether `value` is phrasing content.
|
|
15282
|
+
*/
|
|
15283
|
+
|
|
15284
|
+
const phrasing =
|
|
15285
|
+
/** @type {(node?: unknown) => node is PhrasingContent} */
|
|
15286
|
+
(
|
|
15287
|
+
convert([
|
|
15288
|
+
'break',
|
|
15289
|
+
'delete',
|
|
15290
|
+
'emphasis',
|
|
15291
|
+
'footnote',
|
|
15292
|
+
'footnoteReference',
|
|
15293
|
+
'image',
|
|
15294
|
+
'imageReference',
|
|
15295
|
+
'inlineCode',
|
|
15296
|
+
'link',
|
|
15297
|
+
'linkReference',
|
|
15298
|
+
'strong',
|
|
15299
|
+
'text'
|
|
15300
|
+
])
|
|
15301
|
+
);
|
|
15302
|
+
|
|
15449
15303
|
/**
|
|
15450
15304
|
* @import {Blockquote, Parents} from 'mdast'
|
|
15451
15305
|
* @import {Info, Map, State} from 'mdast-util-to-markdown'
|
|
15452
15306
|
*/
|
|
15453
15307
|
|
|
15454
15308
|
/**
|
|
15309
|
+
* Serialize a blockquote node.
|
|
15310
|
+
*
|
|
15455
15311
|
* @param {Blockquote} node
|
|
15312
|
+
* Node to serialize.
|
|
15456
15313
|
* @param {Parents | undefined} _
|
|
15314
|
+
* Parent node.
|
|
15457
15315
|
* @param {State} state
|
|
15316
|
+
* Info passed around.
|
|
15458
15317
|
* @param {Info} info
|
|
15318
|
+
* Info on surrounding context.
|
|
15459
15319
|
* @returns {string}
|
|
15320
|
+
* Serialized markdown.
|
|
15460
15321
|
*/
|
|
15461
15322
|
function blockquote(node, _, state, info) {
|
|
15462
15323
|
const exit = state.enter('blockquote');
|
|
@@ -15471,7 +15332,11 @@ function blockquote(node, _, state, info) {
|
|
|
15471
15332
|
return value
|
|
15472
15333
|
}
|
|
15473
15334
|
|
|
15474
|
-
/**
|
|
15335
|
+
/**
|
|
15336
|
+
* Indent lines w/ blockquote markers.
|
|
15337
|
+
*
|
|
15338
|
+
* @type {Map}
|
|
15339
|
+
*/
|
|
15475
15340
|
function map$1(line, _, blank) {
|
|
15476
15341
|
return '>' + (blank ? '' : ' ') + line
|
|
15477
15342
|
}
|
|
@@ -15481,9 +15346,14 @@ function map$1(line, _, blank) {
|
|
|
15481
15346
|
*/
|
|
15482
15347
|
|
|
15483
15348
|
/**
|
|
15349
|
+
* Check if a pattern is in scope based on the current stack of constructs.
|
|
15350
|
+
*
|
|
15484
15351
|
* @param {Array<ConstructName>} stack
|
|
15352
|
+
* Current stack of constructs.
|
|
15485
15353
|
* @param {Unsafe} pattern
|
|
15354
|
+
* Pattern to check.
|
|
15486
15355
|
* @returns {boolean}
|
|
15356
|
+
* Whether the pattern is in scope.
|
|
15487
15357
|
*/
|
|
15488
15358
|
function patternInScope(stack, pattern) {
|
|
15489
15359
|
return (
|
|
@@ -15493,10 +15363,16 @@ function patternInScope(stack, pattern) {
|
|
|
15493
15363
|
}
|
|
15494
15364
|
|
|
15495
15365
|
/**
|
|
15366
|
+
* Check if any of the constructs in the list are present in the stack.
|
|
15367
|
+
*
|
|
15496
15368
|
* @param {Array<ConstructName>} stack
|
|
15369
|
+
* Current stack of constructs.
|
|
15497
15370
|
* @param {Unsafe['inConstruct']} list
|
|
15371
|
+
* List of constructs to check for in the stack.
|
|
15498
15372
|
* @param {boolean} none
|
|
15373
|
+
* Value to return if the list is empty or not provided.
|
|
15499
15374
|
* @returns {boolean}
|
|
15375
|
+
* Whether any of the constructs in the list are present in the stack.
|
|
15500
15376
|
*/
|
|
15501
15377
|
function listInScope(stack, list, none) {
|
|
15502
15378
|
if (typeof list === 'string') {
|
|
@@ -15525,23 +15401,34 @@ function listInScope(stack, list, none) {
|
|
|
15525
15401
|
|
|
15526
15402
|
|
|
15527
15403
|
/**
|
|
15404
|
+
* Serialize a break node.
|
|
15405
|
+
*
|
|
15528
15406
|
* @param {Break} _
|
|
15407
|
+
* Node to serialize.
|
|
15529
15408
|
* @param {Parents | undefined} _1
|
|
15409
|
+
* Parent node.
|
|
15530
15410
|
* @param {State} state
|
|
15411
|
+
* Info passed around.
|
|
15531
15412
|
* @param {Info} info
|
|
15413
|
+
* Info on surrounding context.
|
|
15532
15414
|
* @returns {string}
|
|
15415
|
+
* Serialized markdown.
|
|
15533
15416
|
*/
|
|
15534
15417
|
function hardBreak(_, _1, state, info) {
|
|
15535
15418
|
let index = -1;
|
|
15536
15419
|
|
|
15537
15420
|
while (++index < state.unsafe.length) {
|
|
15538
|
-
|
|
15539
|
-
|
|
15421
|
+
const pattern = state.unsafe[index];
|
|
15422
|
+
|
|
15423
|
+
// If we can’t put unconditional eols in this construct (setext headings,
|
|
15424
|
+
// tables), use a space instead.
|
|
15540
15425
|
if (
|
|
15541
|
-
|
|
15542
|
-
|
|
15426
|
+
pattern.character === '\n' &&
|
|
15427
|
+
!pattern.before &&
|
|
15428
|
+
!pattern.after &&
|
|
15429
|
+
patternInScope(state.stack, pattern)
|
|
15543
15430
|
) {
|
|
15544
|
-
return /[
|
|
15431
|
+
return /[\t ]/.test(info.before) ? '' : ' '
|
|
15545
15432
|
}
|
|
15546
15433
|
}
|
|
15547
15434
|
|
|
@@ -15591,20 +15478,25 @@ function longestStreak(value, substring) {
|
|
|
15591
15478
|
*/
|
|
15592
15479
|
|
|
15593
15480
|
/**
|
|
15481
|
+
* Checks if a code block can be formatted as an indented code block.
|
|
15482
|
+
*
|
|
15594
15483
|
* @param {Code} node
|
|
15484
|
+
* Node to check.
|
|
15595
15485
|
* @param {State} state
|
|
15486
|
+
* Info passed around.
|
|
15596
15487
|
* @returns {boolean}
|
|
15488
|
+
* Whether the code can be formatted as an indented code block.
|
|
15597
15489
|
*/
|
|
15598
15490
|
function formatCodeAsIndented(node, state) {
|
|
15599
15491
|
return Boolean(
|
|
15600
15492
|
state.options.fences === false &&
|
|
15601
|
-
|
|
15602
|
-
|
|
15603
|
-
|
|
15604
|
-
|
|
15605
|
-
|
|
15606
|
-
|
|
15607
|
-
|
|
15493
|
+
node.value &&
|
|
15494
|
+
// If there’s no info…
|
|
15495
|
+
!node.lang &&
|
|
15496
|
+
// And there’s a non-whitespace character…
|
|
15497
|
+
/[^\n\r ]/.test(node.value) &&
|
|
15498
|
+
// And the value doesn’t start or end in a blank…
|
|
15499
|
+
!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(node.value)
|
|
15608
15500
|
)
|
|
15609
15501
|
}
|
|
15610
15502
|
|
|
@@ -15613,8 +15505,12 @@ function formatCodeAsIndented(node, state) {
|
|
|
15613
15505
|
*/
|
|
15614
15506
|
|
|
15615
15507
|
/**
|
|
15508
|
+
* Checks the preferred fence option.
|
|
15509
|
+
*
|
|
15616
15510
|
* @param {State} state
|
|
15511
|
+
* Info passed around.
|
|
15617
15512
|
* @returns {Exclude<Options['fence'], null | undefined>}
|
|
15513
|
+
* Preferred fence marker.
|
|
15618
15514
|
*/
|
|
15619
15515
|
function checkFence(state) {
|
|
15620
15516
|
const marker = state.options.fence || '`';
|
|
@@ -15637,16 +15533,22 @@ function checkFence(state) {
|
|
|
15637
15533
|
|
|
15638
15534
|
|
|
15639
15535
|
/**
|
|
15536
|
+
* Serialize a code node.
|
|
15537
|
+
*
|
|
15640
15538
|
* @param {Code} node
|
|
15539
|
+
* Node to serialize.
|
|
15641
15540
|
* @param {Parents | undefined} _
|
|
15541
|
+
* Parent node.
|
|
15642
15542
|
* @param {State} state
|
|
15543
|
+
* Info passed around.
|
|
15643
15544
|
* @param {Info} info
|
|
15545
|
+
* Info on surrounding context.
|
|
15644
15546
|
* @returns {string}
|
|
15547
|
+
* Serialized markdown.
|
|
15645
15548
|
*/
|
|
15646
15549
|
function code$1(node, _, state, info) {
|
|
15647
15550
|
const marker = checkFence(state);
|
|
15648
15551
|
const raw = node.value || '';
|
|
15649
|
-
const suffix = marker === '`' ? 'GraveAccent' : 'Tilde';
|
|
15650
15552
|
|
|
15651
15553
|
if (formatCodeAsIndented(node, state)) {
|
|
15652
15554
|
const exit = state.enter('codeIndented');
|
|
@@ -15658,6 +15560,7 @@ function code$1(node, _, state, info) {
|
|
|
15658
15560
|
const tracker = state.createTracker(info);
|
|
15659
15561
|
const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
|
|
15660
15562
|
const exit = state.enter('codeFenced');
|
|
15563
|
+
const suffix = marker === '`' ? 'GraveAccent' : 'Tilde';
|
|
15661
15564
|
let value = tracker.move(sequence);
|
|
15662
15565
|
|
|
15663
15566
|
if (node.lang) {
|
|
@@ -15698,7 +15601,11 @@ function code$1(node, _, state, info) {
|
|
|
15698
15601
|
return value
|
|
15699
15602
|
}
|
|
15700
15603
|
|
|
15701
|
-
/**
|
|
15604
|
+
/**
|
|
15605
|
+
* Indent lines w/ code indent.
|
|
15606
|
+
*
|
|
15607
|
+
* @type {Map}
|
|
15608
|
+
*/
|
|
15702
15609
|
function map(line, _, blank) {
|
|
15703
15610
|
return (blank ? '' : ' ') + line
|
|
15704
15611
|
}
|
|
@@ -15708,8 +15615,12 @@ function map(line, _, blank) {
|
|
|
15708
15615
|
*/
|
|
15709
15616
|
|
|
15710
15617
|
/**
|
|
15618
|
+
* Checks the preferred quote option.
|
|
15619
|
+
*
|
|
15711
15620
|
* @param {State} state
|
|
15621
|
+
* Info passed around.
|
|
15712
15622
|
* @returns {Exclude<Options['quote'], null | undefined>}
|
|
15623
|
+
* Preferred quote.
|
|
15713
15624
|
*/
|
|
15714
15625
|
function checkQuote(state) {
|
|
15715
15626
|
const marker = state.options.quote || '"';
|
|
@@ -15732,11 +15643,18 @@ function checkQuote(state) {
|
|
|
15732
15643
|
|
|
15733
15644
|
|
|
15734
15645
|
/**
|
|
15646
|
+
* Serialize a definition node.
|
|
15647
|
+
*
|
|
15735
15648
|
* @param {Definition} node
|
|
15649
|
+
* Node to serialize.
|
|
15736
15650
|
* @param {Parents | undefined} _
|
|
15651
|
+
* Parent node.
|
|
15737
15652
|
* @param {State} state
|
|
15653
|
+
* Info passed around.
|
|
15738
15654
|
* @param {Info} info
|
|
15655
|
+
* Info on surrounding context.
|
|
15739
15656
|
* @returns {string}
|
|
15657
|
+
* Serialized markdown.
|
|
15740
15658
|
*/
|
|
15741
15659
|
function definition(node, _, state, info) {
|
|
15742
15660
|
const quote = checkQuote(state);
|
|
@@ -15806,8 +15724,12 @@ function definition(node, _, state, info) {
|
|
|
15806
15724
|
*/
|
|
15807
15725
|
|
|
15808
15726
|
/**
|
|
15727
|
+
* Checks the preferred emphasis option.
|
|
15728
|
+
*
|
|
15809
15729
|
* @param {State} state
|
|
15730
|
+
* Info passed around.
|
|
15810
15731
|
* @returns {Exclude<Options['emphasis'], null | undefined>}
|
|
15732
|
+
* Preferred emphasis marker.
|
|
15811
15733
|
*/
|
|
15812
15734
|
function checkEmphasis(state) {
|
|
15813
15735
|
const marker = state.options.emphasis || '*';
|
|
@@ -15824,166 +15746,84 @@ function checkEmphasis(state) {
|
|
|
15824
15746
|
}
|
|
15825
15747
|
|
|
15826
15748
|
/**
|
|
15827
|
-
*
|
|
15828
|
-
*
|
|
15829
|
-
* @param {number} code
|
|
15830
|
-
* Code point to encode.
|
|
15831
|
-
* @returns {string}
|
|
15832
|
-
* Encoded character reference.
|
|
15749
|
+
* @import {AttentionInfo, Info, State} from 'mdast-util-to-markdown'
|
|
15750
|
+
* @import {Emphasis, Parents} from 'mdast'
|
|
15833
15751
|
*/
|
|
15834
|
-
function encodeCharacterReference(code) {
|
|
15835
|
-
return '&#x' + code.toString(16).toUpperCase() + ';'
|
|
15836
|
-
}
|
|
15837
15752
|
|
|
15838
|
-
/**
|
|
15839
|
-
* @import {EncodeSides} from '../types.js'
|
|
15840
|
-
*/
|
|
15841
15753
|
|
|
15754
|
+
emphasis.attention = attention$1;
|
|
15755
|
+
emphasis.peek = peek$1;
|
|
15842
15756
|
|
|
15843
15757
|
/**
|
|
15844
|
-
*
|
|
15845
|
-
* surrounding an attention run.
|
|
15758
|
+
* Serialize an emphasis node.
|
|
15846
15759
|
*
|
|
15847
|
-
*
|
|
15848
|
-
* not.
|
|
15849
|
-
*
|
|
15850
|
-
* See <https://github.com/orgs/syntax-tree/discussions/60> for more info.
|
|
15851
|
-
* See this markdown in a particular renderer to see what works:
|
|
15852
|
-
*
|
|
15853
|
-
* ```markdown
|
|
15854
|
-
* | | A (letter inside) | B (punctuation inside) | C (whitespace inside) | D (nothing inside) |
|
|
15855
|
-
* | ----------------------- | ----------------- | ---------------------- | --------------------- | ------------------ |
|
|
15856
|
-
* | 1 (letter outside) | x*y*z | x*.*z | x* *z | x**z |
|
|
15857
|
-
* | 2 (punctuation outside) | .*y*. | .*.*. | .* *. | .**. |
|
|
15858
|
-
* | 3 (whitespace outside) | x *y* z | x *.* z | x * * z | x ** z |
|
|
15859
|
-
* | 4 (nothing outside) | *x* | *.* | * * | ** |
|
|
15860
|
-
* ```
|
|
15760
|
+
* Attention is properly handled by `containerPhrasing`.
|
|
15861
15761
|
*
|
|
15862
|
-
* @param {number} outside
|
|
15863
|
-
* Code point on the outer side of the run.
|
|
15864
|
-
* @param {number} inside
|
|
15865
|
-
* Code point on the inner side of the run.
|
|
15866
|
-
* @param {'*' | '_'} marker
|
|
15867
|
-
* Marker of the run.
|
|
15868
|
-
* Underscores are handled more strictly (they form less often) than
|
|
15869
|
-
* asterisks.
|
|
15870
|
-
* @returns {EncodeSides}
|
|
15871
|
-
* Whether to encode characters.
|
|
15872
|
-
*/
|
|
15873
|
-
// Important: punctuation must never be encoded.
|
|
15874
|
-
// Punctuation is solely used by markdown constructs.
|
|
15875
|
-
// And by encoding itself.
|
|
15876
|
-
// Encoding them will break constructs or double encode things.
|
|
15877
|
-
function encodeInfo(outside, inside, marker) {
|
|
15878
|
-
const outsideKind = classifyCharacter(outside);
|
|
15879
|
-
const insideKind = classifyCharacter(inside);
|
|
15880
|
-
|
|
15881
|
-
// Letter outside:
|
|
15882
|
-
if (outsideKind === undefined) {
|
|
15883
|
-
return insideKind === undefined
|
|
15884
|
-
? // Letter inside:
|
|
15885
|
-
// we have to encode *both* letters for `_` as it is looser.
|
|
15886
|
-
// it already forms for `*` (and GFMs `~`).
|
|
15887
|
-
marker === '_'
|
|
15888
|
-
? {inside: true, outside: true}
|
|
15889
|
-
: {inside: false, outside: false}
|
|
15890
|
-
: insideKind === 1
|
|
15891
|
-
? // Whitespace inside: encode both (letter, whitespace).
|
|
15892
|
-
{inside: true, outside: true}
|
|
15893
|
-
: // Punctuation inside: encode outer (letter)
|
|
15894
|
-
{inside: false, outside: true}
|
|
15895
|
-
}
|
|
15896
|
-
|
|
15897
|
-
// Whitespace outside:
|
|
15898
|
-
if (outsideKind === 1) {
|
|
15899
|
-
return insideKind === undefined
|
|
15900
|
-
? // Letter inside: already forms.
|
|
15901
|
-
{inside: false, outside: false}
|
|
15902
|
-
: insideKind === 1
|
|
15903
|
-
? // Whitespace inside: encode both (whitespace).
|
|
15904
|
-
{inside: true, outside: true}
|
|
15905
|
-
: // Punctuation inside: already forms.
|
|
15906
|
-
{inside: false, outside: false}
|
|
15907
|
-
}
|
|
15908
|
-
|
|
15909
|
-
// Punctuation outside:
|
|
15910
|
-
return insideKind === undefined
|
|
15911
|
-
? // Letter inside: already forms.
|
|
15912
|
-
{inside: false, outside: false}
|
|
15913
|
-
: insideKind === 1
|
|
15914
|
-
? // Whitespace inside: encode inner (whitespace).
|
|
15915
|
-
{inside: true, outside: false}
|
|
15916
|
-
: // Punctuation inside: already forms.
|
|
15917
|
-
{inside: false, outside: false}
|
|
15918
|
-
}
|
|
15919
|
-
|
|
15920
|
-
/**
|
|
15921
|
-
* @import {Info, State} from 'mdast-util-to-markdown'
|
|
15922
|
-
* @import {Emphasis, Parents} from 'mdast'
|
|
15923
|
-
*/
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
emphasis.peek = emphasisPeek;
|
|
15927
|
-
|
|
15928
|
-
/**
|
|
15929
15762
|
* @param {Emphasis} node
|
|
15763
|
+
* Node to serialize.
|
|
15930
15764
|
* @param {Parents | undefined} _
|
|
15765
|
+
* Parent node.
|
|
15931
15766
|
* @param {State} state
|
|
15767
|
+
* Info passed around.
|
|
15932
15768
|
* @param {Info} info
|
|
15769
|
+
* Info on surrounding context.
|
|
15933
15770
|
* @returns {string}
|
|
15771
|
+
* Serialized markdown.
|
|
15934
15772
|
*/
|
|
15935
15773
|
function emphasis(node, _, state, info) {
|
|
15936
|
-
const
|
|
15937
|
-
const
|
|
15938
|
-
const tracker = state.createTracker(info);
|
|
15939
|
-
const before = tracker.move(marker);
|
|
15940
|
-
|
|
15941
|
-
let between = tracker.move(
|
|
15942
|
-
state.containerPhrasing(node, {
|
|
15943
|
-
after: marker,
|
|
15944
|
-
before,
|
|
15945
|
-
...tracker.current()
|
|
15946
|
-
})
|
|
15947
|
-
);
|
|
15948
|
-
const betweenHead = between.charCodeAt(0);
|
|
15949
|
-
const open = encodeInfo(
|
|
15950
|
-
info.before.charCodeAt(info.before.length - 1),
|
|
15951
|
-
betweenHead,
|
|
15952
|
-
marker
|
|
15953
|
-
);
|
|
15954
|
-
|
|
15955
|
-
if (open.inside) {
|
|
15956
|
-
between = encodeCharacterReference(betweenHead) + between.slice(1);
|
|
15957
|
-
}
|
|
15958
|
-
|
|
15959
|
-
const betweenTail = between.charCodeAt(between.length - 1);
|
|
15960
|
-
const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
|
|
15961
|
-
|
|
15962
|
-
if (close.inside) {
|
|
15963
|
-
between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
|
|
15964
|
-
}
|
|
15965
|
-
|
|
15966
|
-
const after = tracker.move(marker);
|
|
15967
|
-
|
|
15774
|
+
const exit = state.enter('phrasing');
|
|
15775
|
+
const value = state.containerPhrasing({type: 'root', children: [node]}, info);
|
|
15968
15776
|
exit();
|
|
15777
|
+
return value
|
|
15778
|
+
}
|
|
15969
15779
|
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15780
|
+
/**
|
|
15781
|
+
* Serialize an emphasis node as attention.
|
|
15782
|
+
*
|
|
15783
|
+
* @param {Emphasis} _
|
|
15784
|
+
* Node to serialize.
|
|
15785
|
+
* @param {State} state
|
|
15786
|
+
* Info passed around.
|
|
15787
|
+
* @returns {AttentionInfo}
|
|
15788
|
+
* Info on how to serialize the node.
|
|
15789
|
+
*/
|
|
15790
|
+
function attention$1(_, state) {
|
|
15791
|
+
const marker = checkEmphasis(state);
|
|
15792
|
+
return {
|
|
15793
|
+
construct: 'emphasis',
|
|
15794
|
+
markers: marker === '*' ? ['*', '_'] : ['_', '*'],
|
|
15795
|
+
sizes: [1]
|
|
15796
|
+
}
|
|
15975
15797
|
}
|
|
15976
15798
|
|
|
15977
15799
|
/**
|
|
15800
|
+
* Peek at this node.
|
|
15801
|
+
*
|
|
15978
15802
|
* @param {Emphasis} _
|
|
15803
|
+
* Node to serialize.
|
|
15979
15804
|
* @param {Parents | undefined} _1
|
|
15805
|
+
* Parent node.
|
|
15980
15806
|
* @param {State} state
|
|
15807
|
+
* Info passed around.
|
|
15981
15808
|
* @returns {string}
|
|
15809
|
+
* Start of the serialized markdown.
|
|
15982
15810
|
*/
|
|
15983
|
-
function
|
|
15811
|
+
function peek$1(_, _1, state) {
|
|
15984
15812
|
return state.options.emphasis || '*'
|
|
15985
15813
|
}
|
|
15986
15814
|
|
|
15815
|
+
/**
|
|
15816
|
+
* Encode a code point as a character reference.
|
|
15817
|
+
*
|
|
15818
|
+
* @param {number} code
|
|
15819
|
+
* Code point to encode.
|
|
15820
|
+
* @returns {string}
|
|
15821
|
+
* Encoded character reference.
|
|
15822
|
+
*/
|
|
15823
|
+
function encodeCharacterReference(code) {
|
|
15824
|
+
return '&#x' + code.toString(16).toUpperCase() + ';'
|
|
15825
|
+
}
|
|
15826
|
+
|
|
15987
15827
|
/**
|
|
15988
15828
|
* @import {State} from 'mdast-util-to-markdown'
|
|
15989
15829
|
* @import {Heading} from 'mdast'
|
|
@@ -15991,9 +15831,14 @@ function emphasisPeek(_, _1, state) {
|
|
|
15991
15831
|
|
|
15992
15832
|
|
|
15993
15833
|
/**
|
|
15834
|
+
* Checks if a heading can be formatted as a setext heading.
|
|
15835
|
+
*
|
|
15994
15836
|
* @param {Heading} node
|
|
15837
|
+
* Node to check.
|
|
15995
15838
|
* @param {State} state
|
|
15839
|
+
* Info passed around.
|
|
15996
15840
|
* @returns {boolean}
|
|
15841
|
+
* Whether the heading can be formatted as a setext heading.
|
|
15997
15842
|
*/
|
|
15998
15843
|
function formatHeadingAsSetext(node, state) {
|
|
15999
15844
|
let literalWithBreak = false;
|
|
@@ -16012,8 +15857,8 @@ function formatHeadingAsSetext(node, state) {
|
|
|
16012
15857
|
|
|
16013
15858
|
return Boolean(
|
|
16014
15859
|
(!node.depth || node.depth < 3) &&
|
|
16015
|
-
|
|
16016
|
-
|
|
15860
|
+
toString(node) &&
|
|
15861
|
+
(state.options.setext || literalWithBreak)
|
|
16017
15862
|
)
|
|
16018
15863
|
}
|
|
16019
15864
|
|
|
@@ -16024,11 +15869,18 @@ function formatHeadingAsSetext(node, state) {
|
|
|
16024
15869
|
|
|
16025
15870
|
|
|
16026
15871
|
/**
|
|
15872
|
+
* Serialize a heading node.
|
|
15873
|
+
*
|
|
16027
15874
|
* @param {Heading} node
|
|
15875
|
+
* Node to serialize.
|
|
16028
15876
|
* @param {Parents | undefined} _
|
|
15877
|
+
* Parent node.
|
|
16029
15878
|
* @param {State} state
|
|
15879
|
+
* Info passed around.
|
|
16030
15880
|
* @param {Info} info
|
|
15881
|
+
* Info on surrounding context.
|
|
16031
15882
|
* @returns {string}
|
|
15883
|
+
* Serialized markdown.
|
|
16032
15884
|
*/
|
|
16033
15885
|
function heading(node, _, state, info) {
|
|
16034
15886
|
const rank = Math.max(Math.min(6, node.depth || 1), 1);
|
|
@@ -16074,9 +15926,11 @@ function heading(node, _, state, info) {
|
|
|
16074
15926
|
...tracker.current()
|
|
16075
15927
|
});
|
|
16076
15928
|
|
|
16077
|
-
|
|
15929
|
+
const head = value.charCodeAt(0);
|
|
15930
|
+
|
|
15931
|
+
if (head === 9 /* `\t` */ || head === 32 /* ` ` */) {
|
|
16078
15932
|
// To do: what effect has the character reference on tracking?
|
|
16079
|
-
value = encodeCharacterReference(
|
|
15933
|
+
value = encodeCharacterReference(head) + value.slice(1);
|
|
16080
15934
|
}
|
|
16081
15935
|
|
|
16082
15936
|
value = value ? sequence + ' ' + value : sequence;
|
|
@@ -16098,15 +15952,22 @@ function heading(node, _, state, info) {
|
|
|
16098
15952
|
html$4.peek = htmlPeek;
|
|
16099
15953
|
|
|
16100
15954
|
/**
|
|
15955
|
+
* Serialize an HTML node.
|
|
15956
|
+
*
|
|
16101
15957
|
* @param {Html} node
|
|
15958
|
+
* Node to serialize.
|
|
16102
15959
|
* @returns {string}
|
|
15960
|
+
* Serialized markdown.
|
|
16103
15961
|
*/
|
|
16104
15962
|
function html$4(node) {
|
|
16105
15963
|
return node.value || ''
|
|
16106
15964
|
}
|
|
16107
15965
|
|
|
16108
15966
|
/**
|
|
15967
|
+
* Peek at this node.
|
|
15968
|
+
*
|
|
16109
15969
|
* @returns {string}
|
|
15970
|
+
* Start of the serialized markdown.
|
|
16110
15971
|
*/
|
|
16111
15972
|
function htmlPeek() {
|
|
16112
15973
|
return '<'
|
|
@@ -16121,11 +15982,18 @@ function htmlPeek() {
|
|
|
16121
15982
|
image.peek = imagePeek;
|
|
16122
15983
|
|
|
16123
15984
|
/**
|
|
15985
|
+
* Serialize an image node.
|
|
15986
|
+
*
|
|
16124
15987
|
* @param {Image} node
|
|
15988
|
+
* Node to serialize.
|
|
16125
15989
|
* @param {Parents | undefined} _
|
|
15990
|
+
* Parent node.
|
|
16126
15991
|
* @param {State} state
|
|
15992
|
+
* Info passed around.
|
|
16127
15993
|
* @param {Info} info
|
|
15994
|
+
* Info on surrounding context.
|
|
16128
15995
|
* @returns {string}
|
|
15996
|
+
* Serialized markdown.
|
|
16129
15997
|
*/
|
|
16130
15998
|
function image(node, _, state, info) {
|
|
16131
15999
|
const quote = checkQuote(state);
|
|
@@ -16188,7 +16056,10 @@ function image(node, _, state, info) {
|
|
|
16188
16056
|
}
|
|
16189
16057
|
|
|
16190
16058
|
/**
|
|
16059
|
+
* Peek at this node.
|
|
16060
|
+
*
|
|
16191
16061
|
* @returns {string}
|
|
16062
|
+
* Start of the serialized markdown.
|
|
16192
16063
|
*/
|
|
16193
16064
|
function imagePeek() {
|
|
16194
16065
|
return '!'
|
|
@@ -16202,11 +16073,18 @@ function imagePeek() {
|
|
|
16202
16073
|
imageReference.peek = imageReferencePeek;
|
|
16203
16074
|
|
|
16204
16075
|
/**
|
|
16076
|
+
* Serialize an image reference node.
|
|
16077
|
+
*
|
|
16205
16078
|
* @param {ImageReference} node
|
|
16079
|
+
* Node to serialize.
|
|
16206
16080
|
* @param {Parents | undefined} _
|
|
16081
|
+
* Parent node.
|
|
16207
16082
|
* @param {State} state
|
|
16083
|
+
* Info passed around.
|
|
16208
16084
|
* @param {Info} info
|
|
16085
|
+
* Info on surrounding context.
|
|
16209
16086
|
* @returns {string}
|
|
16087
|
+
* Serialized markdown.
|
|
16210
16088
|
*/
|
|
16211
16089
|
function imageReference(node, _, state, info) {
|
|
16212
16090
|
const type = node.referenceType;
|
|
@@ -16222,9 +16100,14 @@ function imageReference(node, _, state, info) {
|
|
|
16222
16100
|
value += tracker.move(alt + '][');
|
|
16223
16101
|
|
|
16224
16102
|
subexit();
|
|
16225
|
-
// Hide
|
|
16103
|
+
// Hide that we’re in phrasing as things like attention or code cannot form
|
|
16104
|
+
// in references.
|
|
16105
|
+
// Character escapes and references *do* work.
|
|
16106
|
+
// It is important to know about other constructs, such as table cells.
|
|
16226
16107
|
const stack = state.stack;
|
|
16227
|
-
state.stack =
|
|
16108
|
+
state.stack = stack.filter(function (d) {
|
|
16109
|
+
return d !== 'phrasing'
|
|
16110
|
+
});
|
|
16228
16111
|
subexit = state.enter('reference');
|
|
16229
16112
|
// Note: for proper tracking, we should reset the output positions when we end
|
|
16230
16113
|
// up making a `shortcut` reference, because then there is no brace output.
|
|
@@ -16252,7 +16135,10 @@ function imageReference(node, _, state, info) {
|
|
|
16252
16135
|
}
|
|
16253
16136
|
|
|
16254
16137
|
/**
|
|
16138
|
+
* Peek at this node.
|
|
16139
|
+
*
|
|
16255
16140
|
* @returns {string}
|
|
16141
|
+
* Start of the serialized markdown.
|
|
16256
16142
|
*/
|
|
16257
16143
|
function imageReferencePeek() {
|
|
16258
16144
|
return '!'
|
|
@@ -16266,10 +16152,16 @@ function imageReferencePeek() {
|
|
|
16266
16152
|
inlineCode.peek = inlineCodePeek;
|
|
16267
16153
|
|
|
16268
16154
|
/**
|
|
16155
|
+
* Serialize an inline code node.
|
|
16156
|
+
*
|
|
16269
16157
|
* @param {InlineCode} node
|
|
16158
|
+
* Node to serialize.
|
|
16270
16159
|
* @param {Parents | undefined} _
|
|
16160
|
+
* Parent node.
|
|
16271
16161
|
* @param {State} state
|
|
16162
|
+
* Info passed around.
|
|
16272
16163
|
* @returns {string}
|
|
16164
|
+
* Serialized markdown.
|
|
16273
16165
|
*/
|
|
16274
16166
|
function inlineCode(node, _, state) {
|
|
16275
16167
|
let value = node.value || '';
|
|
@@ -16286,8 +16178,8 @@ function inlineCode(node, _, state) {
|
|
|
16286
16178
|
// If this is not just spaces or eols (tabs don’t count), and either the
|
|
16287
16179
|
// first or last character are a space, eol, or tick, then pad with spaces.
|
|
16288
16180
|
if (
|
|
16289
|
-
/[
|
|
16290
|
-
((/^[
|
|
16181
|
+
/[^\n\r ]/.test(value) &&
|
|
16182
|
+
((/^[\n\r ]/.test(value) && /[\n\r ]$/.test(value)) || /^`|`$/.test(value))
|
|
16291
16183
|
) {
|
|
16292
16184
|
value = ' ' + value + ' ';
|
|
16293
16185
|
}
|
|
@@ -16302,14 +16194,15 @@ function inlineCode(node, _, state) {
|
|
|
16302
16194
|
while (++index < state.unsafe.length) {
|
|
16303
16195
|
const pattern = state.unsafe[index];
|
|
16304
16196
|
const expression = state.compilePattern(pattern);
|
|
16305
|
-
/** @type {RegExpExecArray | null} */
|
|
16306
|
-
let match;
|
|
16307
16197
|
|
|
16308
16198
|
// Only look for `atBreak`s.
|
|
16309
16199
|
// Btw: note that `atBreak` patterns will always start the regex at LF or
|
|
16310
16200
|
// CR.
|
|
16311
16201
|
if (!pattern.atBreak) continue
|
|
16312
16202
|
|
|
16203
|
+
/** @type {RegExpExecArray | null} */
|
|
16204
|
+
let match;
|
|
16205
|
+
|
|
16313
16206
|
while ((match = expression.exec(value))) {
|
|
16314
16207
|
let position = match.index;
|
|
16315
16208
|
|
|
@@ -16329,7 +16222,10 @@ function inlineCode(node, _, state) {
|
|
|
16329
16222
|
}
|
|
16330
16223
|
|
|
16331
16224
|
/**
|
|
16225
|
+
* Peek at this node.
|
|
16226
|
+
*
|
|
16332
16227
|
* @returns {string}
|
|
16228
|
+
* Start of the serialized markdown.
|
|
16333
16229
|
*/
|
|
16334
16230
|
function inlineCodePeek() {
|
|
16335
16231
|
return '`'
|
|
@@ -16342,30 +16238,35 @@ function inlineCodePeek() {
|
|
|
16342
16238
|
|
|
16343
16239
|
|
|
16344
16240
|
/**
|
|
16241
|
+
* Checks if a link can be formatted as an autolink.
|
|
16242
|
+
*
|
|
16345
16243
|
* @param {Link} node
|
|
16244
|
+
* Node to check.
|
|
16346
16245
|
* @param {State} state
|
|
16246
|
+
* Info passed around.
|
|
16347
16247
|
* @returns {boolean}
|
|
16248
|
+
* Whether the link can be formatted as an autolink.
|
|
16348
16249
|
*/
|
|
16349
16250
|
function formatLinkAsAutolink(node, state) {
|
|
16350
16251
|
const raw = toString(node);
|
|
16351
16252
|
|
|
16352
16253
|
return Boolean(
|
|
16353
16254
|
!state.options.resourceLink &&
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
|
|
16357
|
-
|
|
16358
|
-
|
|
16359
|
-
|
|
16360
|
-
|
|
16361
|
-
|
|
16362
|
-
|
|
16363
|
-
|
|
16364
|
-
|
|
16365
|
-
|
|
16366
|
-
|
|
16367
|
-
|
|
16368
|
-
|
|
16255
|
+
// If there’s a url…
|
|
16256
|
+
node.url &&
|
|
16257
|
+
// And there’s no title…
|
|
16258
|
+
!node.title &&
|
|
16259
|
+
// And the content of `node` is a single text node…
|
|
16260
|
+
node.children &&
|
|
16261
|
+
node.children.length === 1 &&
|
|
16262
|
+
node.children[0].type === 'text' &&
|
|
16263
|
+
// And if the url is the same as the content…
|
|
16264
|
+
(raw === node.url || 'mailto:' + raw === node.url) &&
|
|
16265
|
+
// And that starts w/ a protocol…
|
|
16266
|
+
/^[a-z][+\-.a-z]+:/i.test(node.url) &&
|
|
16267
|
+
// And that doesn’t contain ASCII control codes (character escapes and
|
|
16268
|
+
// references don’t work), space, or angle brackets…
|
|
16269
|
+
!/[\0- <>\u007F]/.test(node.url)
|
|
16369
16270
|
)
|
|
16370
16271
|
}
|
|
16371
16272
|
|
|
@@ -16379,26 +16280,35 @@ function formatLinkAsAutolink(node, state) {
|
|
|
16379
16280
|
link.peek = linkPeek;
|
|
16380
16281
|
|
|
16381
16282
|
/**
|
|
16283
|
+
* Serialize a link node.
|
|
16284
|
+
*
|
|
16382
16285
|
* @param {Link} node
|
|
16286
|
+
* Node to serialize.
|
|
16383
16287
|
* @param {Parents | undefined} _
|
|
16288
|
+
* Parent node.
|
|
16384
16289
|
* @param {State} state
|
|
16290
|
+
* Info passed around.
|
|
16385
16291
|
* @param {Info} info
|
|
16292
|
+
* Info on surrounding context.
|
|
16386
16293
|
* @returns {string}
|
|
16294
|
+
* Serialized markdown.
|
|
16387
16295
|
*/
|
|
16388
16296
|
function link(node, _, state, info) {
|
|
16389
16297
|
const quote = checkQuote(state);
|
|
16390
16298
|
const suffix = quote === '"' ? 'Quote' : 'Apostrophe';
|
|
16391
16299
|
const tracker = state.createTracker(info);
|
|
16392
|
-
/** @type {Exit} */
|
|
16393
|
-
let exit;
|
|
16394
|
-
/** @type {Exit} */
|
|
16395
|
-
let subexit;
|
|
16396
16300
|
|
|
16397
16301
|
if (formatLinkAsAutolink(node, state)) {
|
|
16398
|
-
// Hide
|
|
16302
|
+
// Hide that we’re in phrasing as things like attention or code cannot form
|
|
16303
|
+
// in autolinks.
|
|
16304
|
+
// Character escapes also don’t work (nor character references),
|
|
16305
|
+
// but that is a different matter, which `safe.js` handles for `autolink`.
|
|
16306
|
+
// It is important to know about other constructs, such as table cells.
|
|
16399
16307
|
const stack = state.stack;
|
|
16400
|
-
state.stack =
|
|
16401
|
-
|
|
16308
|
+
state.stack = stack.filter(function (d) {
|
|
16309
|
+
return d !== 'phrasing'
|
|
16310
|
+
});
|
|
16311
|
+
const exit = state.enter('autolink');
|
|
16402
16312
|
let value = tracker.move('<');
|
|
16403
16313
|
value += tracker.move(
|
|
16404
16314
|
state.containerPhrasing(node, {
|
|
@@ -16413,8 +16323,8 @@ function link(node, _, state, info) {
|
|
|
16413
16323
|
return value
|
|
16414
16324
|
}
|
|
16415
16325
|
|
|
16416
|
-
exit = state.enter('link');
|
|
16417
|
-
subexit = state.enter('label');
|
|
16326
|
+
const exit = state.enter('link');
|
|
16327
|
+
let subexit = state.enter('label');
|
|
16418
16328
|
let value = tracker.move('[');
|
|
16419
16329
|
value += tracker.move(
|
|
16420
16330
|
state.containerPhrasing(node, {
|
|
@@ -16473,10 +16383,16 @@ function link(node, _, state, info) {
|
|
|
16473
16383
|
}
|
|
16474
16384
|
|
|
16475
16385
|
/**
|
|
16386
|
+
* Peek at this node.
|
|
16387
|
+
*
|
|
16476
16388
|
* @param {Link} node
|
|
16389
|
+
* Node to peek at.
|
|
16477
16390
|
* @param {Parents | undefined} _
|
|
16391
|
+
* Parent node.
|
|
16478
16392
|
* @param {State} state
|
|
16393
|
+
* Info passed around.
|
|
16479
16394
|
* @returns {string}
|
|
16395
|
+
* Start of the serialized markdown.
|
|
16480
16396
|
*/
|
|
16481
16397
|
function linkPeek(node, _, state) {
|
|
16482
16398
|
return formatLinkAsAutolink(node, state) ? '<' : '['
|
|
@@ -16490,11 +16406,18 @@ function linkPeek(node, _, state) {
|
|
|
16490
16406
|
linkReference.peek = linkReferencePeek;
|
|
16491
16407
|
|
|
16492
16408
|
/**
|
|
16409
|
+
* Serialize a link reference node.
|
|
16410
|
+
*
|
|
16493
16411
|
* @param {LinkReference} node
|
|
16412
|
+
* Node to serialize.
|
|
16494
16413
|
* @param {Parents | undefined} _
|
|
16414
|
+
* Parent node.
|
|
16495
16415
|
* @param {State} state
|
|
16416
|
+
* Info passed around.
|
|
16496
16417
|
* @param {Info} info
|
|
16418
|
+
* Info on surrounding context.
|
|
16497
16419
|
* @returns {string}
|
|
16420
|
+
* Serialized markdown.
|
|
16498
16421
|
*/
|
|
16499
16422
|
function linkReference(node, _, state, info) {
|
|
16500
16423
|
const type = node.referenceType;
|
|
@@ -16510,9 +16433,14 @@ function linkReference(node, _, state, info) {
|
|
|
16510
16433
|
value += tracker.move(text + '][');
|
|
16511
16434
|
|
|
16512
16435
|
subexit();
|
|
16513
|
-
// Hide
|
|
16436
|
+
// Hide that we’re in phrasing as things like attention or code cannot form
|
|
16437
|
+
// in references.
|
|
16438
|
+
// Character escapes and references *do* work.
|
|
16439
|
+
// It is important to know about other constructs, such as table cells.
|
|
16514
16440
|
const stack = state.stack;
|
|
16515
|
-
state.stack =
|
|
16441
|
+
state.stack = stack.filter(function (d) {
|
|
16442
|
+
return d !== 'phrasing'
|
|
16443
|
+
});
|
|
16516
16444
|
subexit = state.enter('reference');
|
|
16517
16445
|
// Note: for proper tracking, we should reset the output positions when we end
|
|
16518
16446
|
// up making a `shortcut` reference, because then there is no brace output.
|
|
@@ -16540,7 +16468,10 @@ function linkReference(node, _, state, info) {
|
|
|
16540
16468
|
}
|
|
16541
16469
|
|
|
16542
16470
|
/**
|
|
16471
|
+
* Peek at this node.
|
|
16472
|
+
*
|
|
16543
16473
|
* @returns {string}
|
|
16474
|
+
* Start of the serialized markdown.
|
|
16544
16475
|
*/
|
|
16545
16476
|
function linkReferencePeek() {
|
|
16546
16477
|
return '['
|
|
@@ -16551,8 +16482,12 @@ function linkReferencePeek() {
|
|
|
16551
16482
|
*/
|
|
16552
16483
|
|
|
16553
16484
|
/**
|
|
16485
|
+
* Checks the preferred list bullet option.
|
|
16486
|
+
*
|
|
16554
16487
|
* @param {State} state
|
|
16488
|
+
* Info passed around.
|
|
16555
16489
|
* @returns {Exclude<Options['bullet'], null | undefined>}
|
|
16490
|
+
* Preferred list bullet.
|
|
16556
16491
|
*/
|
|
16557
16492
|
function checkBullet(state) {
|
|
16558
16493
|
const marker = state.options.bullet || '*';
|
|
@@ -16574,8 +16509,12 @@ function checkBullet(state) {
|
|
|
16574
16509
|
|
|
16575
16510
|
|
|
16576
16511
|
/**
|
|
16512
|
+
* Checks the preferred alternate list bullet option.
|
|
16513
|
+
*
|
|
16577
16514
|
* @param {State} state
|
|
16515
|
+
* Info passed around.
|
|
16578
16516
|
* @returns {Exclude<Options['bullet'], null | undefined>}
|
|
16517
|
+
* Preferred alternate list bullet.
|
|
16579
16518
|
*/
|
|
16580
16519
|
function checkBulletOther(state) {
|
|
16581
16520
|
const bullet = checkBullet(state);
|
|
@@ -16611,8 +16550,12 @@ function checkBulletOther(state) {
|
|
|
16611
16550
|
*/
|
|
16612
16551
|
|
|
16613
16552
|
/**
|
|
16553
|
+
* Checks the preferred ordered list bullet option.
|
|
16554
|
+
*
|
|
16614
16555
|
* @param {State} state
|
|
16556
|
+
* Info passed around.
|
|
16615
16557
|
* @returns {Exclude<Options['bulletOrdered'], null | undefined>}
|
|
16558
|
+
* Preferred ordered list bullet.
|
|
16616
16559
|
*/
|
|
16617
16560
|
function checkBulletOrdered(state) {
|
|
16618
16561
|
const marker = state.options.bulletOrdered || '.';
|
|
@@ -16633,8 +16576,12 @@ function checkBulletOrdered(state) {
|
|
|
16633
16576
|
*/
|
|
16634
16577
|
|
|
16635
16578
|
/**
|
|
16579
|
+
* Checks the preferred rule option.
|
|
16580
|
+
*
|
|
16636
16581
|
* @param {State} state
|
|
16582
|
+
* Info passed around.
|
|
16637
16583
|
* @returns {Exclude<Options['rule'], null | undefined>}
|
|
16584
|
+
* Preferred rule marker.
|
|
16638
16585
|
*/
|
|
16639
16586
|
function checkRule(state) {
|
|
16640
16587
|
const marker = state.options.rule || '*';
|
|
@@ -16657,11 +16604,18 @@ function checkRule(state) {
|
|
|
16657
16604
|
|
|
16658
16605
|
|
|
16659
16606
|
/**
|
|
16607
|
+
* Serialize a list node.
|
|
16608
|
+
*
|
|
16660
16609
|
* @param {List} node
|
|
16610
|
+
* Node to serialize.
|
|
16661
16611
|
* @param {Parents | undefined} parent
|
|
16612
|
+
* Parent node.
|
|
16662
16613
|
* @param {State} state
|
|
16614
|
+
* Info passed around.
|
|
16663
16615
|
* @param {Info} info
|
|
16616
|
+
* Info on surrounding context.
|
|
16664
16617
|
* @returns {string}
|
|
16618
|
+
* Serialized markdown.
|
|
16665
16619
|
*/
|
|
16666
16620
|
function list(node, parent, state, info) {
|
|
16667
16621
|
const exit = state.enter('list');
|
|
@@ -16752,8 +16706,12 @@ function list(node, parent, state, info) {
|
|
|
16752
16706
|
*/
|
|
16753
16707
|
|
|
16754
16708
|
/**
|
|
16709
|
+
* Checks the preferred list item indent option.
|
|
16710
|
+
*
|
|
16755
16711
|
* @param {State} state
|
|
16712
|
+
* Info passed around.
|
|
16756
16713
|
* @returns {Exclude<Options['listItemIndent'], null | undefined>}
|
|
16714
|
+
* Preferred list item indent.
|
|
16757
16715
|
*/
|
|
16758
16716
|
function checkListItemIndent(state) {
|
|
16759
16717
|
const style = state.options.listItemIndent || 'one';
|
|
@@ -16776,11 +16734,18 @@ function checkListItemIndent(state) {
|
|
|
16776
16734
|
|
|
16777
16735
|
|
|
16778
16736
|
/**
|
|
16737
|
+
* Serialize a list item node.
|
|
16738
|
+
*
|
|
16779
16739
|
* @param {ListItem} node
|
|
16740
|
+
* Node to serialize.
|
|
16780
16741
|
* @param {Parents | undefined} parent
|
|
16742
|
+
* Parent node.
|
|
16781
16743
|
* @param {State} state
|
|
16744
|
+
* Info passed around.
|
|
16782
16745
|
* @param {Info} info
|
|
16746
|
+
* Info on surrounding context.
|
|
16783
16747
|
* @returns {string}
|
|
16748
|
+
* Serialized markdown.
|
|
16784
16749
|
*/
|
|
16785
16750
|
function listItem(node, parent, state, info) {
|
|
16786
16751
|
const listItemIndent = checkListItemIndent(state);
|
|
@@ -16820,7 +16785,11 @@ function listItem(node, parent, state, info) {
|
|
|
16820
16785
|
|
|
16821
16786
|
return value
|
|
16822
16787
|
|
|
16823
|
-
/**
|
|
16788
|
+
/**
|
|
16789
|
+
* Indent lines of the list item.
|
|
16790
|
+
*
|
|
16791
|
+
* @type {Map}
|
|
16792
|
+
*/
|
|
16824
16793
|
function map(line, index, blank) {
|
|
16825
16794
|
if (index) {
|
|
16826
16795
|
return (blank ? '' : ' '.repeat(size)) + line
|
|
@@ -16836,11 +16805,18 @@ function listItem(node, parent, state, info) {
|
|
|
16836
16805
|
*/
|
|
16837
16806
|
|
|
16838
16807
|
/**
|
|
16808
|
+
* Serialize a paragraph node.
|
|
16809
|
+
*
|
|
16839
16810
|
* @param {Paragraph} node
|
|
16811
|
+
* Node to serialize.
|
|
16840
16812
|
* @param {Parents | undefined} _
|
|
16813
|
+
* Parent node.
|
|
16841
16814
|
* @param {State} state
|
|
16815
|
+
* Info passed around.
|
|
16842
16816
|
* @param {Info} info
|
|
16817
|
+
* Info on surrounding context.
|
|
16843
16818
|
* @returns {string}
|
|
16819
|
+
* Serialized markdown.
|
|
16844
16820
|
*/
|
|
16845
16821
|
function paragraph(node, _, state, info) {
|
|
16846
16822
|
const exit = state.enter('paragraph');
|
|
@@ -16851,41 +16827,6 @@ function paragraph(node, _, state, info) {
|
|
|
16851
16827
|
return value
|
|
16852
16828
|
}
|
|
16853
16829
|
|
|
16854
|
-
/**
|
|
16855
|
-
* @typedef {import('mdast').PhrasingContent} PhrasingContent
|
|
16856
|
-
*/
|
|
16857
|
-
|
|
16858
|
-
|
|
16859
|
-
/**
|
|
16860
|
-
* Check if the given value is *phrasing content*.
|
|
16861
|
-
*
|
|
16862
|
-
* > 👉 **Note**: Excludes `html`, which can be both phrasing or flow.
|
|
16863
|
-
*
|
|
16864
|
-
* @param node
|
|
16865
|
-
* Thing to check, typically `Node`.
|
|
16866
|
-
* @returns
|
|
16867
|
-
* Whether `value` is phrasing content.
|
|
16868
|
-
*/
|
|
16869
|
-
|
|
16870
|
-
const phrasing =
|
|
16871
|
-
/** @type {(node?: unknown) => node is PhrasingContent} */
|
|
16872
|
-
(
|
|
16873
|
-
convert([
|
|
16874
|
-
'break',
|
|
16875
|
-
'delete',
|
|
16876
|
-
'emphasis',
|
|
16877
|
-
'footnote',
|
|
16878
|
-
'footnoteReference',
|
|
16879
|
-
'image',
|
|
16880
|
-
'imageReference',
|
|
16881
|
-
'inlineCode',
|
|
16882
|
-
'link',
|
|
16883
|
-
'linkReference',
|
|
16884
|
-
'strong',
|
|
16885
|
-
'text'
|
|
16886
|
-
])
|
|
16887
|
-
);
|
|
16888
|
-
|
|
16889
16830
|
/**
|
|
16890
16831
|
* @import {Info, State} from 'mdast-util-to-markdown'
|
|
16891
16832
|
* @import {Parents, Root} from 'mdast'
|
|
@@ -16893,11 +16834,18 @@ const phrasing =
|
|
|
16893
16834
|
|
|
16894
16835
|
|
|
16895
16836
|
/**
|
|
16837
|
+
* Serialize a root node.
|
|
16838
|
+
*
|
|
16896
16839
|
* @param {Root} node
|
|
16840
|
+
* Node to serialize.
|
|
16897
16841
|
* @param {Parents | undefined} _
|
|
16842
|
+
* Parent node.
|
|
16898
16843
|
* @param {State} state
|
|
16844
|
+
* Info passed around.
|
|
16899
16845
|
* @param {Info} info
|
|
16846
|
+
* Info on surrounding context.
|
|
16900
16847
|
* @returns {string}
|
|
16848
|
+
* Serialized markdown.
|
|
16901
16849
|
*/
|
|
16902
16850
|
function root$2(node, _, state, info) {
|
|
16903
16851
|
// Note: `html` nodes are ambiguous.
|
|
@@ -16905,8 +16853,12 @@ function root$2(node, _, state, info) {
|
|
|
16905
16853
|
return phrasing(d)
|
|
16906
16854
|
});
|
|
16907
16855
|
|
|
16908
|
-
|
|
16909
|
-
|
|
16856
|
+
if (!hasPhrasing) return state.containerFlow(node, info)
|
|
16857
|
+
|
|
16858
|
+
const exit = state.enter('phrasing');
|
|
16859
|
+
const value = state.containerPhrasing(node, info);
|
|
16860
|
+
exit();
|
|
16861
|
+
return value
|
|
16910
16862
|
}
|
|
16911
16863
|
|
|
16912
16864
|
/**
|
|
@@ -16914,8 +16866,12 @@ function root$2(node, _, state, info) {
|
|
|
16914
16866
|
*/
|
|
16915
16867
|
|
|
16916
16868
|
/**
|
|
16869
|
+
* Checks the preferred strong option.
|
|
16870
|
+
*
|
|
16917
16871
|
* @param {State} state
|
|
16872
|
+
* Info passed around.
|
|
16918
16873
|
* @returns {Exclude<Options['strong'], null | undefined>}
|
|
16874
|
+
* Preferred strong marker.
|
|
16919
16875
|
*/
|
|
16920
16876
|
function checkStrong(state) {
|
|
16921
16877
|
const marker = state.options.strong || '*';
|
|
@@ -16932,69 +16888,69 @@ function checkStrong(state) {
|
|
|
16932
16888
|
}
|
|
16933
16889
|
|
|
16934
16890
|
/**
|
|
16935
|
-
* @import {Info, State} from 'mdast-util-to-markdown'
|
|
16891
|
+
* @import {AttentionInfo, Info, State} from 'mdast-util-to-markdown'
|
|
16936
16892
|
* @import {Parents, Strong} from 'mdast'
|
|
16937
16893
|
*/
|
|
16938
16894
|
|
|
16939
16895
|
|
|
16940
|
-
strong.
|
|
16896
|
+
strong.attention = attention;
|
|
16897
|
+
strong.peek = peek;
|
|
16941
16898
|
|
|
16942
16899
|
/**
|
|
16900
|
+
* Serialize a strong node.
|
|
16901
|
+
*
|
|
16902
|
+
* Attention is properly handled by `containerPhrasing`.
|
|
16903
|
+
*
|
|
16943
16904
|
* @param {Strong} node
|
|
16905
|
+
* Node to serialize.
|
|
16944
16906
|
* @param {Parents | undefined} _
|
|
16907
|
+
* Parent node.
|
|
16945
16908
|
* @param {State} state
|
|
16909
|
+
* Info passed around.
|
|
16946
16910
|
* @param {Info} info
|
|
16911
|
+
* Info on surrounding context.
|
|
16947
16912
|
* @returns {string}
|
|
16913
|
+
* Serialized markdown.
|
|
16948
16914
|
*/
|
|
16949
16915
|
function strong(node, _, state, info) {
|
|
16950
|
-
const
|
|
16951
|
-
const
|
|
16952
|
-
const tracker = state.createTracker(info);
|
|
16953
|
-
const before = tracker.move(marker + marker);
|
|
16954
|
-
|
|
16955
|
-
let between = tracker.move(
|
|
16956
|
-
state.containerPhrasing(node, {
|
|
16957
|
-
after: marker,
|
|
16958
|
-
before,
|
|
16959
|
-
...tracker.current()
|
|
16960
|
-
})
|
|
16961
|
-
);
|
|
16962
|
-
const betweenHead = between.charCodeAt(0);
|
|
16963
|
-
const open = encodeInfo(
|
|
16964
|
-
info.before.charCodeAt(info.before.length - 1),
|
|
16965
|
-
betweenHead,
|
|
16966
|
-
marker
|
|
16967
|
-
);
|
|
16968
|
-
|
|
16969
|
-
if (open.inside) {
|
|
16970
|
-
between = encodeCharacterReference(betweenHead) + between.slice(1);
|
|
16971
|
-
}
|
|
16972
|
-
|
|
16973
|
-
const betweenTail = between.charCodeAt(between.length - 1);
|
|
16974
|
-
const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
|
|
16975
|
-
|
|
16976
|
-
if (close.inside) {
|
|
16977
|
-
between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
|
|
16978
|
-
}
|
|
16979
|
-
|
|
16980
|
-
const after = tracker.move(marker + marker);
|
|
16981
|
-
|
|
16916
|
+
const exit = state.enter('phrasing');
|
|
16917
|
+
const value = state.containerPhrasing({type: 'root', children: [node]}, info);
|
|
16982
16918
|
exit();
|
|
16919
|
+
return value
|
|
16920
|
+
}
|
|
16983
16921
|
|
|
16984
|
-
|
|
16985
|
-
|
|
16986
|
-
|
|
16987
|
-
|
|
16988
|
-
|
|
16922
|
+
/**
|
|
16923
|
+
* Serialize a strong node as attention.
|
|
16924
|
+
*
|
|
16925
|
+
* @param {Strong} _
|
|
16926
|
+
* Node to serialize.
|
|
16927
|
+
* @param {State} state
|
|
16928
|
+
* Info passed around.
|
|
16929
|
+
* @returns {AttentionInfo}
|
|
16930
|
+
* Info on how to serialize the node.
|
|
16931
|
+
*/
|
|
16932
|
+
function attention(_, state) {
|
|
16933
|
+
const marker = checkStrong(state);
|
|
16934
|
+
return {
|
|
16935
|
+
construct: 'strong',
|
|
16936
|
+
markers: marker === '*' ? ['*', '_'] : ['_', '*'],
|
|
16937
|
+
sizes: [2]
|
|
16938
|
+
}
|
|
16989
16939
|
}
|
|
16990
16940
|
|
|
16991
16941
|
/**
|
|
16942
|
+
* Peek at this node.
|
|
16943
|
+
*
|
|
16992
16944
|
* @param {Strong} _
|
|
16945
|
+
* Node to serialize.
|
|
16993
16946
|
* @param {Parents | undefined} _1
|
|
16947
|
+
* Parent node.
|
|
16994
16948
|
* @param {State} state
|
|
16949
|
+
* Info passed around.
|
|
16995
16950
|
* @returns {string}
|
|
16951
|
+
* Start of the serialized markdown.
|
|
16996
16952
|
*/
|
|
16997
|
-
function
|
|
16953
|
+
function peek(_, _1, state) {
|
|
16998
16954
|
return state.options.strong || '*'
|
|
16999
16955
|
}
|
|
17000
16956
|
|
|
@@ -17004,11 +16960,18 @@ function strongPeek(_, _1, state) {
|
|
|
17004
16960
|
*/
|
|
17005
16961
|
|
|
17006
16962
|
/**
|
|
16963
|
+
* Serialize a text node.
|
|
16964
|
+
*
|
|
17007
16965
|
* @param {Text} node
|
|
16966
|
+
* Node to serialize.
|
|
17008
16967
|
* @param {Parents | undefined} _
|
|
16968
|
+
* Parent node.
|
|
17009
16969
|
* @param {State} state
|
|
16970
|
+
* Info passed around.
|
|
17010
16971
|
* @param {Info} info
|
|
16972
|
+
* Info on surrounding context.
|
|
17011
16973
|
* @returns {string}
|
|
16974
|
+
* Serialized markdown.
|
|
17012
16975
|
*/
|
|
17013
16976
|
function text$3(node, _, state, info) {
|
|
17014
16977
|
return state.safe(node.value, info)
|
|
@@ -17019,8 +16982,12 @@ function text$3(node, _, state, info) {
|
|
|
17019
16982
|
*/
|
|
17020
16983
|
|
|
17021
16984
|
/**
|
|
16985
|
+
* Checks the preferred rule repetition option.
|
|
16986
|
+
*
|
|
17022
16987
|
* @param {State} state
|
|
16988
|
+
* Info passed around.
|
|
17023
16989
|
* @returns {Exclude<Options['ruleRepetition'], null | undefined>}
|
|
16990
|
+
* Preferred rule repetition.
|
|
17024
16991
|
*/
|
|
17025
16992
|
function checkRuleRepetition(state) {
|
|
17026
16993
|
const repetition = state.options.ruleRepetition || 3;
|
|
@@ -17043,10 +17010,16 @@ function checkRuleRepetition(state) {
|
|
|
17043
17010
|
|
|
17044
17011
|
|
|
17045
17012
|
/**
|
|
17013
|
+
* Serialize a thematic break node.
|
|
17014
|
+
*
|
|
17046
17015
|
* @param {ThematicBreak} _
|
|
17016
|
+
* Node to serialize.
|
|
17047
17017
|
* @param {Parents | undefined} _1
|
|
17018
|
+
* Parent node.
|
|
17048
17019
|
* @param {State} state
|
|
17020
|
+
* Info passed around.
|
|
17049
17021
|
* @returns {string}
|
|
17022
|
+
* Serialized markdown.
|
|
17050
17023
|
*/
|
|
17051
17024
|
function thematicBreak(_, _1, state) {
|
|
17052
17025
|
const value = (
|
|
@@ -17188,7 +17161,7 @@ function exitCodeText(token) {
|
|
|
17188
17161
|
let value = this.resume();
|
|
17189
17162
|
|
|
17190
17163
|
if (this.data.inTable) {
|
|
17191
|
-
value = value.replace(/\\([\\|])/g, replace);
|
|
17164
|
+
value = value.replace(/\\([\\|])/g, replace$1);
|
|
17192
17165
|
}
|
|
17193
17166
|
|
|
17194
17167
|
const node = this.stack[this.stack.length - 1];
|
|
@@ -17201,7 +17174,7 @@ function exitCodeText(token) {
|
|
|
17201
17174
|
* @param {string} $1
|
|
17202
17175
|
* @returns {string}
|
|
17203
17176
|
*/
|
|
17204
|
-
function replace($0, $1) {
|
|
17177
|
+
function replace$1($0, $1) {
|
|
17205
17178
|
// Pipes work, backslashes don’t (but can’t escape pipes).
|
|
17206
17179
|
return $1 === '|' ? $1 : $0
|
|
17207
17180
|
}
|
|
@@ -20563,6 +20536,59 @@ function remarkGfm(options) {
|
|
|
20563
20536
|
toMarkdownExtensions.push(gfmToMarkdown(settings));
|
|
20564
20537
|
}
|
|
20565
20538
|
|
|
20539
|
+
/**
|
|
20540
|
+
* @typedef {import('mdast').Nodes} Nodes
|
|
20541
|
+
* @typedef {import('mdast-util-find-and-replace').ReplaceFunction} ReplaceFunction
|
|
20542
|
+
*/
|
|
20543
|
+
|
|
20544
|
+
|
|
20545
|
+
/**
|
|
20546
|
+
* Turn normal line endings into hard breaks.
|
|
20547
|
+
*
|
|
20548
|
+
* @param {Nodes} tree
|
|
20549
|
+
* Tree to change.
|
|
20550
|
+
* @returns {undefined}
|
|
20551
|
+
* Nothing.
|
|
20552
|
+
*/
|
|
20553
|
+
function newlineToBreak(tree) {
|
|
20554
|
+
findAndReplace(tree, [/\r?\n|\r/g, replace]);
|
|
20555
|
+
}
|
|
20556
|
+
|
|
20557
|
+
/**
|
|
20558
|
+
* Replace line endings.
|
|
20559
|
+
*
|
|
20560
|
+
* @type {ReplaceFunction}
|
|
20561
|
+
*/
|
|
20562
|
+
function replace() {
|
|
20563
|
+
return {type: 'break'}
|
|
20564
|
+
}
|
|
20565
|
+
|
|
20566
|
+
/**
|
|
20567
|
+
* @typedef {import('mdast').Root} Root
|
|
20568
|
+
*/
|
|
20569
|
+
|
|
20570
|
+
|
|
20571
|
+
/**
|
|
20572
|
+
* Support hard breaks without needing spaces or escapes (turns enters into
|
|
20573
|
+
* `<br>`s).
|
|
20574
|
+
*
|
|
20575
|
+
* @returns
|
|
20576
|
+
* Transform.
|
|
20577
|
+
*/
|
|
20578
|
+
function remarkBreaks() {
|
|
20579
|
+
/**
|
|
20580
|
+
* Transform.
|
|
20581
|
+
*
|
|
20582
|
+
* @param {Root} tree
|
|
20583
|
+
* Tree.
|
|
20584
|
+
* @returns {undefined}
|
|
20585
|
+
* Nothing.
|
|
20586
|
+
*/
|
|
20587
|
+
return function (tree) {
|
|
20588
|
+
newlineToBreak(tree);
|
|
20589
|
+
}
|
|
20590
|
+
}
|
|
20591
|
+
|
|
20566
20592
|
/**
|
|
20567
20593
|
* @typedef {import('./info.js').Info} Info
|
|
20568
20594
|
* @typedef {Record<string, Info>} Properties
|
|
@@ -21820,157 +21846,6 @@ function camelcase$1($0) {
|
|
|
21820
21846
|
const html$2 = merge$1([xml$1, xlink$1, xmlns$1, aria$1, html$3], 'html');
|
|
21821
21847
|
const svg$2 = merge$1([xml$1, xlink$1, xmlns$1, aria$1, svg$3], 'svg');
|
|
21822
21848
|
|
|
21823
|
-
/**
|
|
21824
|
-
* @typedef Options
|
|
21825
|
-
* Configuration for `stringify`.
|
|
21826
|
-
* @property {boolean} [padLeft=true]
|
|
21827
|
-
* Whether to pad a space before a token.
|
|
21828
|
-
* @property {boolean} [padRight=false]
|
|
21829
|
-
* Whether to pad a space after a token.
|
|
21830
|
-
*/
|
|
21831
|
-
|
|
21832
|
-
/**
|
|
21833
|
-
* @typedef {Options} StringifyOptions
|
|
21834
|
-
* Please use `StringifyOptions` instead.
|
|
21835
|
-
*/
|
|
21836
|
-
|
|
21837
|
-
/**
|
|
21838
|
-
* Parse comma-separated tokens to an array.
|
|
21839
|
-
*
|
|
21840
|
-
* @param {string} value
|
|
21841
|
-
* Comma-separated tokens.
|
|
21842
|
-
* @returns {Array<string>}
|
|
21843
|
-
* List of tokens.
|
|
21844
|
-
*/
|
|
21845
|
-
function parse$1(value) {
|
|
21846
|
-
/** @type {Array<string>} */
|
|
21847
|
-
const tokens = [];
|
|
21848
|
-
const input = String(value || '');
|
|
21849
|
-
let index = input.indexOf(',');
|
|
21850
|
-
let start = 0;
|
|
21851
|
-
/** @type {boolean} */
|
|
21852
|
-
let end = false;
|
|
21853
|
-
|
|
21854
|
-
while (!end) {
|
|
21855
|
-
if (index === -1) {
|
|
21856
|
-
index = input.length;
|
|
21857
|
-
end = true;
|
|
21858
|
-
}
|
|
21859
|
-
|
|
21860
|
-
const token = input.slice(start, index).trim();
|
|
21861
|
-
|
|
21862
|
-
if (token || !end) {
|
|
21863
|
-
tokens.push(token);
|
|
21864
|
-
}
|
|
21865
|
-
|
|
21866
|
-
start = index + 1;
|
|
21867
|
-
index = input.indexOf(',', start);
|
|
21868
|
-
}
|
|
21869
|
-
|
|
21870
|
-
return tokens
|
|
21871
|
-
}
|
|
21872
|
-
|
|
21873
|
-
/**
|
|
21874
|
-
* @typedef {import('hast').Element} Element
|
|
21875
|
-
* @typedef {import('hast').Properties} Properties
|
|
21876
|
-
*/
|
|
21877
|
-
|
|
21878
|
-
/**
|
|
21879
|
-
* @template {string} SimpleSelector
|
|
21880
|
-
* Selector type.
|
|
21881
|
-
* @template {string} DefaultTagName
|
|
21882
|
-
* Default tag name.
|
|
21883
|
-
* @typedef {(
|
|
21884
|
-
* SimpleSelector extends ''
|
|
21885
|
-
* ? DefaultTagName
|
|
21886
|
-
* : SimpleSelector extends `${infer TagName}.${infer Rest}`
|
|
21887
|
-
* ? ExtractTagName<TagName, DefaultTagName>
|
|
21888
|
-
* : SimpleSelector extends `${infer TagName}#${infer Rest}`
|
|
21889
|
-
* ? ExtractTagName<TagName, DefaultTagName>
|
|
21890
|
-
* : SimpleSelector extends string
|
|
21891
|
-
* ? SimpleSelector
|
|
21892
|
-
* : DefaultTagName
|
|
21893
|
-
* )} ExtractTagName
|
|
21894
|
-
* Extract tag name from a simple selector.
|
|
21895
|
-
*/
|
|
21896
|
-
|
|
21897
|
-
const search$1 = /[#.]/g;
|
|
21898
|
-
|
|
21899
|
-
/**
|
|
21900
|
-
* Create a hast element from a simple CSS selector.
|
|
21901
|
-
*
|
|
21902
|
-
* @template {string} Selector
|
|
21903
|
-
* Type of selector.
|
|
21904
|
-
* @template {string} [DefaultTagName='div']
|
|
21905
|
-
* Type of default tag name (default: `'div'`).
|
|
21906
|
-
* @param {Selector | null | undefined} [selector]
|
|
21907
|
-
* Simple CSS selector (optional).
|
|
21908
|
-
*
|
|
21909
|
-
* Can contain a tag name (`foo`), classes (`.bar`), and an ID (`#baz`).
|
|
21910
|
-
* Multiple classes are allowed.
|
|
21911
|
-
* Uses the last ID if multiple IDs are found.
|
|
21912
|
-
* @param {DefaultTagName | null | undefined} [defaultTagName='div']
|
|
21913
|
-
* Tag name to use if `selector` does not specify one (default: `'div'`).
|
|
21914
|
-
* @returns {Element & {tagName: ExtractTagName<Selector, DefaultTagName>}}
|
|
21915
|
-
* Built element.
|
|
21916
|
-
*/
|
|
21917
|
-
function parseSelector(selector, defaultTagName) {
|
|
21918
|
-
const value = selector || '';
|
|
21919
|
-
/** @type {Properties} */
|
|
21920
|
-
const props = {};
|
|
21921
|
-
let start = 0;
|
|
21922
|
-
/** @type {string | undefined} */
|
|
21923
|
-
let previous;
|
|
21924
|
-
/** @type {string | undefined} */
|
|
21925
|
-
let tagName;
|
|
21926
|
-
|
|
21927
|
-
while (start < value.length) {
|
|
21928
|
-
search$1.lastIndex = start;
|
|
21929
|
-
const match = search$1.exec(value);
|
|
21930
|
-
const subvalue = value.slice(start, match ? match.index : value.length);
|
|
21931
|
-
|
|
21932
|
-
if (subvalue) {
|
|
21933
|
-
if (!previous) {
|
|
21934
|
-
tagName = subvalue;
|
|
21935
|
-
} else if (previous === '#') {
|
|
21936
|
-
props.id = subvalue;
|
|
21937
|
-
} else if (Array.isArray(props.className)) {
|
|
21938
|
-
props.className.push(subvalue);
|
|
21939
|
-
} else {
|
|
21940
|
-
props.className = [subvalue];
|
|
21941
|
-
}
|
|
21942
|
-
|
|
21943
|
-
start += subvalue.length;
|
|
21944
|
-
}
|
|
21945
|
-
|
|
21946
|
-
if (match) {
|
|
21947
|
-
previous = match[0];
|
|
21948
|
-
start++;
|
|
21949
|
-
}
|
|
21950
|
-
}
|
|
21951
|
-
|
|
21952
|
-
return {
|
|
21953
|
-
type: 'element',
|
|
21954
|
-
// @ts-expect-error: tag name is parsed.
|
|
21955
|
-
tagName: tagName || defaultTagName || 'div',
|
|
21956
|
-
properties: props,
|
|
21957
|
-
children: []
|
|
21958
|
-
}
|
|
21959
|
-
}
|
|
21960
|
-
|
|
21961
|
-
/**
|
|
21962
|
-
* Parse space-separated tokens to an array of strings.
|
|
21963
|
-
*
|
|
21964
|
-
* @param {string} value
|
|
21965
|
-
* Space-separated tokens.
|
|
21966
|
-
* @returns {Array<string>}
|
|
21967
|
-
* List of tokens.
|
|
21968
|
-
*/
|
|
21969
|
-
function parse(value) {
|
|
21970
|
-
const input = String(value || '').trim();
|
|
21971
|
-
return input ? input.split(/[ \t\n\r\f]+/g) : []
|
|
21972
|
-
}
|
|
21973
|
-
|
|
21974
21849
|
/**
|
|
21975
21850
|
* @typedef {import('hast').Element} Element
|
|
21976
21851
|
* @typedef {import('hast').Nodes} Nodes
|
|
@@ -22145,11 +22020,11 @@ function addProperty(schema, properties, key, value) {
|
|
|
22145
22020
|
// Handle list values.
|
|
22146
22021
|
else if (typeof value === 'string') {
|
|
22147
22022
|
if (info.spaceSeparated) {
|
|
22148
|
-
result = parse(value);
|
|
22149
|
-
} else if (info.commaSeparated) {
|
|
22150
22023
|
result = parse$1(value);
|
|
22024
|
+
} else if (info.commaSeparated) {
|
|
22025
|
+
result = parse$2(value);
|
|
22151
22026
|
} else if (info.commaOrSpaceSeparated) {
|
|
22152
|
-
result = parse(parse$
|
|
22027
|
+
result = parse$1(parse$2(value).join(' '));
|
|
22153
22028
|
} else {
|
|
22154
22029
|
result = parsePrimitive(info, info.property, value);
|
|
22155
22030
|
}
|
|
@@ -22466,15 +22341,6 @@ function location(file) {
|
|
|
22466
22341
|
}
|
|
22467
22342
|
}
|
|
22468
22343
|
|
|
22469
|
-
/**
|
|
22470
|
-
* Map of web namespaces.
|
|
22471
|
-
*
|
|
22472
|
-
* @type {Record<string, string>}
|
|
22473
|
-
*/
|
|
22474
|
-
const webNamespaces$1 = {
|
|
22475
|
-
html: 'http://www.w3.org/1999/xhtml',
|
|
22476
|
-
svg: 'http://www.w3.org/2000/svg'};
|
|
22477
|
-
|
|
22478
22344
|
/**
|
|
22479
22345
|
* @typedef {import('hast').Element} Element
|
|
22480
22346
|
* @typedef {import('hast').ElementData} ElementData
|
|
@@ -22631,7 +22497,7 @@ function all$2(state, nodes) {
|
|
|
22631
22497
|
function element$2(state, node) {
|
|
22632
22498
|
const schema = state.schema;
|
|
22633
22499
|
|
|
22634
|
-
state.schema = node.namespaceURI === webNamespaces
|
|
22500
|
+
state.schema = node.namespaceURI === webNamespaces.svg ? svg$2 : html$2;
|
|
22635
22501
|
|
|
22636
22502
|
// Props.
|
|
22637
22503
|
let index = -1;
|
|
@@ -22765,12 +22631,12 @@ function createLocation(state, node, location) {
|
|
|
22765
22631
|
* Position or nothing.
|
|
22766
22632
|
*/
|
|
22767
22633
|
function position(loc) {
|
|
22768
|
-
const start = point
|
|
22634
|
+
const start = point({
|
|
22769
22635
|
line: loc.startLine,
|
|
22770
22636
|
column: loc.startCol,
|
|
22771
22637
|
offset: loc.startOffset
|
|
22772
22638
|
});
|
|
22773
|
-
const end = point
|
|
22639
|
+
const end = point({
|
|
22774
22640
|
line: loc.endLine,
|
|
22775
22641
|
column: loc.endCol,
|
|
22776
22642
|
offset: loc.endOffset
|
|
@@ -22789,45 +22655,10 @@ function position(loc) {
|
|
|
22789
22655
|
* @returns {Point | undefined}
|
|
22790
22656
|
* Point or nothing.
|
|
22791
22657
|
*/
|
|
22792
|
-
function point
|
|
22658
|
+
function point(point) {
|
|
22793
22659
|
return point.line && point.column ? point : undefined
|
|
22794
22660
|
}
|
|
22795
22661
|
|
|
22796
|
-
/**
|
|
22797
|
-
* @typedef Options
|
|
22798
|
-
* Configuration for `stringify`.
|
|
22799
|
-
* @property {boolean} [padLeft=true]
|
|
22800
|
-
* Whether to pad a space before a token.
|
|
22801
|
-
* @property {boolean} [padRight=false]
|
|
22802
|
-
* Whether to pad a space after a token.
|
|
22803
|
-
*/
|
|
22804
|
-
|
|
22805
|
-
|
|
22806
|
-
/**
|
|
22807
|
-
* Serialize an array of strings or numbers to comma-separated tokens.
|
|
22808
|
-
*
|
|
22809
|
-
* @param {Array<string|number>} values
|
|
22810
|
-
* List of tokens.
|
|
22811
|
-
* @param {Options} [options]
|
|
22812
|
-
* Configuration for `stringify` (optional).
|
|
22813
|
-
* @returns {string}
|
|
22814
|
-
* Comma-separated tokens.
|
|
22815
|
-
*/
|
|
22816
|
-
function stringify$1(values, options) {
|
|
22817
|
-
const settings = {};
|
|
22818
|
-
|
|
22819
|
-
// Ensure the last empty entry is seen.
|
|
22820
|
-
const input = values[values.length - 1] === '' ? [...values, ''] : values;
|
|
22821
|
-
|
|
22822
|
-
return input
|
|
22823
|
-
.join(
|
|
22824
|
-
(settings.padRight ? ' ' : '') +
|
|
22825
|
-
',' +
|
|
22826
|
-
(settings.padLeft === false ? '' : ' ')
|
|
22827
|
-
)
|
|
22828
|
-
.trim()
|
|
22829
|
-
}
|
|
22830
|
-
|
|
22831
22662
|
/**
|
|
22832
22663
|
* @typedef {import('./info.js').Info} Info
|
|
22833
22664
|
* @typedef {Record<string, Info>} Properties
|
|
@@ -24085,41 +23916,6 @@ function camelcase($0) {
|
|
|
24085
23916
|
const html = merge([xml, xlink, xmlns, aria, html$1], 'html');
|
|
24086
23917
|
const svg = merge([xml, xlink, xmlns, aria, svg$1], 'svg');
|
|
24087
23918
|
|
|
24088
|
-
/**
|
|
24089
|
-
* Parse space-separated tokens to an array of strings.
|
|
24090
|
-
*
|
|
24091
|
-
* @param {string} value
|
|
24092
|
-
* Space-separated tokens.
|
|
24093
|
-
* @returns {Array<string>}
|
|
24094
|
-
* List of tokens.
|
|
24095
|
-
*/
|
|
24096
|
-
|
|
24097
|
-
/**
|
|
24098
|
-
* Serialize an array of strings as space separated-tokens.
|
|
24099
|
-
*
|
|
24100
|
-
* @param {Array<string|number>} values
|
|
24101
|
-
* List of tokens.
|
|
24102
|
-
* @returns {string}
|
|
24103
|
-
* Space-separated tokens.
|
|
24104
|
-
*/
|
|
24105
|
-
function stringify(values) {
|
|
24106
|
-
return values.join(' ').trim()
|
|
24107
|
-
}
|
|
24108
|
-
|
|
24109
|
-
/**
|
|
24110
|
-
* Map of web namespaces.
|
|
24111
|
-
*
|
|
24112
|
-
* @type {Record<string, string>}
|
|
24113
|
-
*/
|
|
24114
|
-
const webNamespaces = {
|
|
24115
|
-
html: 'http://www.w3.org/1999/xhtml',
|
|
24116
|
-
mathml: 'http://www.w3.org/1998/Math/MathML',
|
|
24117
|
-
svg: 'http://www.w3.org/2000/svg',
|
|
24118
|
-
xlink: 'http://www.w3.org/1999/xlink',
|
|
24119
|
-
xml: 'http://www.w3.org/XML/1998/namespace',
|
|
24120
|
-
xmlns: 'http://www.w3.org/2000/xmlns/'
|
|
24121
|
-
};
|
|
24122
|
-
|
|
24123
23919
|
/**
|
|
24124
23920
|
* @typedef {import('hast').Comment} Comment
|
|
24125
23921
|
* @typedef {import('hast').Doctype} Doctype
|
|
@@ -24352,7 +24148,7 @@ function createProperty(schema, prop, value) {
|
|
|
24352
24148
|
if (Array.isArray(value)) {
|
|
24353
24149
|
// Accept `array`.
|
|
24354
24150
|
// Most props are space-separated.
|
|
24355
|
-
value = info.commaSeparated ? stringify
|
|
24151
|
+
value = info.commaSeparated ? stringify(value) : stringify$1(value);
|
|
24356
24152
|
}
|
|
24357
24153
|
|
|
24358
24154
|
/** @type {Parse5Attribute} */
|
|
@@ -32293,85 +32089,6 @@ function endTagInForeignContent(p, token) {
|
|
|
32293
32089
|
}
|
|
32294
32090
|
}
|
|
32295
32091
|
|
|
32296
|
-
/**
|
|
32297
|
-
* @typedef {import('unist').Node} Node
|
|
32298
|
-
* @typedef {import('unist').Point} Point
|
|
32299
|
-
* @typedef {import('unist').Position} Position
|
|
32300
|
-
*/
|
|
32301
|
-
|
|
32302
|
-
/**
|
|
32303
|
-
* @typedef NodeLike
|
|
32304
|
-
* @property {string} type
|
|
32305
|
-
* @property {PositionLike | null | undefined} [position]
|
|
32306
|
-
*
|
|
32307
|
-
* @typedef PositionLike
|
|
32308
|
-
* @property {PointLike | null | undefined} [start]
|
|
32309
|
-
* @property {PointLike | null | undefined} [end]
|
|
32310
|
-
*
|
|
32311
|
-
* @typedef PointLike
|
|
32312
|
-
* @property {number | null | undefined} [line]
|
|
32313
|
-
* @property {number | null | undefined} [column]
|
|
32314
|
-
* @property {number | null | undefined} [offset]
|
|
32315
|
-
*/
|
|
32316
|
-
|
|
32317
|
-
/**
|
|
32318
|
-
* Get the ending point of `node`.
|
|
32319
|
-
*
|
|
32320
|
-
* @param node
|
|
32321
|
-
* Node.
|
|
32322
|
-
* @returns
|
|
32323
|
-
* Point.
|
|
32324
|
-
*/
|
|
32325
|
-
const pointEnd = point('end');
|
|
32326
|
-
|
|
32327
|
-
/**
|
|
32328
|
-
* Get the starting point of `node`.
|
|
32329
|
-
*
|
|
32330
|
-
* @param node
|
|
32331
|
-
* Node.
|
|
32332
|
-
* @returns
|
|
32333
|
-
* Point.
|
|
32334
|
-
*/
|
|
32335
|
-
const pointStart = point('start');
|
|
32336
|
-
|
|
32337
|
-
/**
|
|
32338
|
-
* Get the positional info of `node`.
|
|
32339
|
-
*
|
|
32340
|
-
* @param {'end' | 'start'} type
|
|
32341
|
-
* Side.
|
|
32342
|
-
* @returns
|
|
32343
|
-
* Getter.
|
|
32344
|
-
*/
|
|
32345
|
-
function point(type) {
|
|
32346
|
-
return point
|
|
32347
|
-
|
|
32348
|
-
/**
|
|
32349
|
-
* Get the point info of `node` at a bound side.
|
|
32350
|
-
*
|
|
32351
|
-
* @param {Node | NodeLike | null | undefined} [node]
|
|
32352
|
-
* @returns {Point | undefined}
|
|
32353
|
-
*/
|
|
32354
|
-
function point(node) {
|
|
32355
|
-
const point = (node && node.position && node.position[type]) || {};
|
|
32356
|
-
|
|
32357
|
-
if (
|
|
32358
|
-
typeof point.line === 'number' &&
|
|
32359
|
-
point.line > 0 &&
|
|
32360
|
-
typeof point.column === 'number' &&
|
|
32361
|
-
point.column > 0
|
|
32362
|
-
) {
|
|
32363
|
-
return {
|
|
32364
|
-
line: point.line,
|
|
32365
|
-
column: point.column,
|
|
32366
|
-
offset:
|
|
32367
|
-
typeof point.offset === 'number' && point.offset > -1
|
|
32368
|
-
? point.offset
|
|
32369
|
-
: undefined
|
|
32370
|
-
}
|
|
32371
|
-
}
|
|
32372
|
-
}
|
|
32373
|
-
}
|
|
32374
|
-
|
|
32375
32092
|
/**
|
|
32376
32093
|
* @typedef {import('hast').Comment} Comment
|
|
32377
32094
|
* @typedef {import('hast').Doctype} Doctype
|
|
@@ -32878,16 +32595,16 @@ function startTag(node, state) {
|
|
|
32878
32595
|
resetTokenizer(state, pointStart(node));
|
|
32879
32596
|
|
|
32880
32597
|
const current = state.parser.openElements.current;
|
|
32881
|
-
let ns = 'namespaceURI' in current ? current.namespaceURI : webNamespaces
|
|
32598
|
+
let ns = 'namespaceURI' in current ? current.namespaceURI : webNamespaces.html;
|
|
32882
32599
|
|
|
32883
|
-
if (ns === webNamespaces
|
|
32884
|
-
ns = webNamespaces
|
|
32600
|
+
if (ns === webNamespaces.html && tagName === 'svg') {
|
|
32601
|
+
ns = webNamespaces.svg;
|
|
32885
32602
|
}
|
|
32886
32603
|
|
|
32887
32604
|
const result = toParse5(
|
|
32888
32605
|
// Shallow clone to not delve into `children`: we only need the attributes.
|
|
32889
32606
|
{...node, children: []},
|
|
32890
|
-
{space: ns === webNamespaces
|
|
32607
|
+
{space: ns === webNamespaces.svg ? 'svg' : 'html'}
|
|
32891
32608
|
);
|
|
32892
32609
|
|
|
32893
32610
|
/** @type {TagToken} */
|
|
@@ -34028,12 +33745,10 @@ const isWhitespace = (value) => {
|
|
|
34028
33745
|
*/
|
|
34029
33746
|
async function markdownToHTML(text, options) {
|
|
34030
33747
|
var _a;
|
|
34031
|
-
if (options === null || options === void 0 ? void 0 : options.forceHardLineBreaks) {
|
|
34032
|
-
text = text.replaceAll(/(?<!\\)([\n\r])/g, ' $1');
|
|
34033
|
-
}
|
|
34034
33748
|
const file = await unified()
|
|
34035
33749
|
.use(remarkParse)
|
|
34036
33750
|
.use(remarkGfm)
|
|
33751
|
+
.use((options === null || options === void 0 ? void 0 : options.forceHardLineBreaks) ? [remarkBreaks] : [])
|
|
34037
33752
|
.use(remarkRehype, { allowDangerousHtml: true })
|
|
34038
33753
|
.use(rehypeRaw)
|
|
34039
33754
|
.use(createLinksPlugin())
|
|
@@ -34125,4 +33840,4 @@ function getWhiteList(allowedComponents) {
|
|
|
34125
33840
|
return whitelist;
|
|
34126
33841
|
}
|
|
34127
33842
|
|
|
34128
|
-
export { getLinkAttributes as g, markdownToHTML as m, sanitizeHTML as s };
|
|
33843
|
+
export { asciiAlpha as a, asciiAlphanumeric as b, htmlBlockNames as c, formatHeadingAsSetext as d, decodeString as e, formatCodeAsIndented as f, getLinkAttributes as g, htmlRawNames as h, classifyCharacter as i, asciiPunctuation as j, encodeCharacterReference as k, handle as l, markdownToHTML as m, phrasing as n, remarkParse as o, patternInScope as p, remarkGfm as r, sanitizeHTML as s, toString as t };
|