rapier-markdown-kit 1.1.73 → 1.1.74
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.
|
@@ -76,7 +76,7 @@ export function readBase(value) {
|
|
|
76
76
|
throw fault('proposal base SHA-256 differs from its text');
|
|
77
77
|
if (typeof value.revision !== 'string' || !value.revision || value.revision.length > 256 || /[\u0000-\u001f\u007f]/.test(value.revision))
|
|
78
78
|
throw fault('invalid proposal base revision');
|
|
79
|
-
if (typeof value.name !== 'string' || !value.name || value.name.length >
|
|
79
|
+
if (typeof value.name !== 'string' || !value.name || [...value.name].length > 256 || /[\\/\u0000-\u001f\u007f]/.test(value.name))
|
|
80
80
|
throw fault('invalid proposal base name');
|
|
81
81
|
if (typeof value.by !== 'string' || !value.by.trim() || value.by.length > 96 || /[\u0000-\u001f\u007f]/.test(value.by))
|
|
82
82
|
throw fault('a proposal needs its proposer name');
|
|
@@ -169,7 +169,7 @@ function initMarkdownIt() {
|
|
|
169
169
|
return key.startsWith('data-') || key === 'for' || key === 'id' && _rapierChromeOwnsId(attributeText(value)) ? '' : whole;
|
|
170
170
|
}) : tag;
|
|
171
171
|
md.renderer.rules.html_inline = (tokens, idx) => cleanTag(tokens[idx].content);
|
|
172
|
-
md.renderer.rules.html_block = (tokens, idx) => _rapierRawHtmlFragment(tokens[idx].content, cleanTag, md)
|
|
172
|
+
md.renderer.rules.html_block = (tokens, idx) => _rapierRawHtmlFragment(tokens[idx].content, cleanTag, md);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
const _ulOpenDefault = md.renderer.rules.bullet_list_open
|
|
@@ -778,8 +778,9 @@ function _rapierNormalizeCodeElement(code) {
|
|
|
778
778
|
|
|
779
779
|
function _rapierLanguageClass(element) {
|
|
780
780
|
if (!element || !element.classList) return '';
|
|
781
|
-
|
|
782
|
-
|
|
781
|
+
// CommonMark's first info word is an identifier, including Unicode and punctuation.
|
|
782
|
+
const found = Array.from(element.classList).find(name => /^language-.+/i.test(name));
|
|
783
|
+
return found ? found.slice(9) : '';
|
|
783
784
|
}
|
|
784
785
|
|
|
785
786
|
function _relabelFootnoteHtml(html, labels) {
|
package/dist/kit/render.mjs
CHANGED
|
@@ -43,7 +43,7 @@ async function _rapierBuildArtifact(options, providedContext) {
|
|
|
43
43
|
print: !!opts.print,
|
|
44
44
|
baseName: base,
|
|
45
45
|
});
|
|
46
|
-
|
|
46
|
+
// _rapierProjectStyledRoot already returns the sanitized projection.
|
|
47
47
|
// Print never emits the layout reflow script (see below), so a print artifact has no use for
|
|
48
48
|
// this annotation -- skip it there rather than pay the cost for numbers nothing will read.
|
|
49
49
|
if (!opts.print) _rapierAnnotateExportBoxPolygons(styledRoot);
|
|
@@ -750,6 +750,8 @@ function _rapierImageSources(tokens) {
|
|
|
750
750
|
}
|
|
751
751
|
|
|
752
752
|
function _rapierImageDestinations(source, accepts) {
|
|
753
|
+
// Only a rendered Markdown image consumes a definition; unused definitions stay literal source.
|
|
754
|
+
if (!source.includes('![')) return [];
|
|
753
755
|
const env = {}, tokens = md.parse(source, env), offsets = _rapierLineStartOffsets(source);
|
|
754
756
|
const hrefs = _rapierImageSources(tokens), labels = new Set(), destinations = [], seen = new Set();
|
|
755
757
|
const visit = rows => { for (const token of rows || []) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapier-markdown-kit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.74",
|
|
4
4
|
"description": "Read, render, write and style Self-contained Markdown, and carry its optional edit ledger: the shared HTML writer, semantic renderer, stylesheet, layout, marks, pictures, Will/1, replay, authorship and offline merge. MIT, no npm dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|