@peaceroad/markdown-it-figure-with-p-caption 0.5.1 → 0.5.2
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/README.md +1 -1
- package/index.js +1 -1
- package/package.json +4 -4
- package/test/examples.txt +11 -0
- package/test/test.js +6 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This is a markdown-it plugin.
|
|
4
4
|
|
|
5
|
-
For a paragraph with one image/images only, a table or code block or a blockquote, and by writing a caption paragraph immediately before or after, they are converted into the figure element with the figcaption element.
|
|
5
|
+
For a paragraph with one image/images only, a table or code block or a blockquote or a iframe, and by writing a caption paragraph immediately before or after, they are converted into the figure element with the figcaption element.
|
|
6
6
|
|
|
7
7
|
1. Check that the element: one image only paragraph, table, code block, samp block, blockquote, and video.
|
|
8
8
|
2. Check if this element has a caption paragraph immediately before or after it
|
package/index.js
CHANGED
|
@@ -263,7 +263,7 @@ module.exports = function figure_with_caption_plugin(md, option) {
|
|
|
263
263
|
tagName = tags[ctj];
|
|
264
264
|
if (tagName === 'iframe') {
|
|
265
265
|
if(/^<[^>]*? src="https:\/\/(?:www.youtube-nocookie.com|player.vimeo.com)\//i.test(token.content)) {
|
|
266
|
-
tagName = 'video';
|
|
266
|
+
tagName = 'video';
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
if (tagName === 'blockquote') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peaceroad/markdown-it-figure-with-p-caption",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "A markdown-it plugin. For a paragraph with only one image, a table or code block or blockquote, and by writing a caption paragraph immediately before or after, they are converted into the figure element with the figcaption element.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"url": "https://github.com/peaceroad/p7d-markdown-it-figure-with-p-caption/issues"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"markdown-it": "^
|
|
17
|
-
"markdown-it-attrs": "^4.1.
|
|
16
|
+
"markdown-it": "^14.1.0",
|
|
17
|
+
"markdown-it-attrs": "^4.1.6"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"p7d-markdown-it-p-captions": "^0.
|
|
20
|
+
"p7d-markdown-it-p-captions": "^0.12.0"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/test/examples.txt
CHANGED
|
@@ -731,6 +731,17 @@ A paragraph.
|
|
|
731
731
|
<iframe class="speakerdeck-iframe" style="border: 0px none; background: rgba(0, 0, 0, 0.1) padding-box; margin: 0px; padding: 0px; border-radius: 6px; box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 40px; width: 100%; height: auto; aspect-ratio: 560 / 314;" src="https://speakerdeck.com/player/xxxxxxxxxxxxxx" title="xxxxxxxxxxx" allowfullscreen="true" data-ratio="1.78343949044586" frameborder="0"></iframe>
|
|
732
732
|
</figure>
|
|
733
733
|
|
|
734
|
+
|
|
735
|
+
[Markdown]
|
|
736
|
+
Slide. A caption.
|
|
737
|
+
|
|
738
|
+
<iframe class="speakerdeck-iframe" style="border: 0px none; background: rgba(0, 0, 0, 0.1) padding-box; margin: 0px; padding: 0px; border-radius: 6px; box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 40px; width: 100%; height: auto; aspect-ratio: 560 / 314;" src="https://speakerdeck.com/player/xxxxxxxxxxxxxx" title="xxxxxxxxxxx" allowfullscreen="true" data-ratio="1.78343949044586" frameborder="0"></iframe>
|
|
739
|
+
[HTML]
|
|
740
|
+
<figure class="f-iframe">
|
|
741
|
+
<figcaption><span class="f-slide-label">Slide<span class="f-slide-label-joint">.</span></span> A caption.</figcaption>
|
|
742
|
+
<iframe class="speakerdeck-iframe" style="border: 0px none; background: rgba(0, 0, 0, 0.1) padding-box; margin: 0px; padding: 0px; border-radius: 6px; box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 40px; width: 100%; height: auto; aspect-ratio: 560 / 314;" src="https://speakerdeck.com/player/xxxxxxxxxxxxxx" title="xxxxxxxxxxx" allowfullscreen="true" data-ratio="1.78343949044586" frameborder="0"></iframe>
|
|
743
|
+
</figure>
|
|
744
|
+
|
|
734
745
|
[Markdown]
|
|
735
746
|
<iframe src="https://player.vimeo.com/video/xxxxxxxxxxxxxxx" width="640" height="360" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe>
|
|
736
747
|
<p><a href="https://vimeo.com/xxxx">Title</a> from <a href="https://vimeo.com/yyy">User</a> on <a href="https://vimeo.com">Vimeo</a>.</p>
|
package/test/test.js
CHANGED
|
@@ -65,9 +65,9 @@ while(n < ms0.length) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
n = 1;
|
|
68
|
+
let pass = true
|
|
68
69
|
while(n < ms.length) {
|
|
69
70
|
//if (n !== 37) { n++; continue };
|
|
70
|
-
console.log('Test: ' + n + ' >>>');
|
|
71
71
|
//console.log(ms[n].markdown);
|
|
72
72
|
|
|
73
73
|
const m = ms[n].markdown;
|
|
@@ -85,8 +85,12 @@ while(n < ms.length) {
|
|
|
85
85
|
try {
|
|
86
86
|
assert.strictEqual(h, ms[n].html);
|
|
87
87
|
} catch(e) {
|
|
88
|
+
pass =false
|
|
89
|
+
console.log('Test: ' + n + ' >>>');
|
|
88
90
|
console.log('incorrect: ');
|
|
89
91
|
console.log('H: ' + h +'C: ' + ms[n].html);
|
|
90
92
|
};
|
|
91
93
|
n++;
|
|
92
|
-
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (pass) console.log('Passed all test.')
|