Skip to content

Commit adcfb85

Browse files
committed
chore(ci): upstream update
1 parent 099b442 commit adcfb85

File tree

4 files changed

+40
-5
lines changed

4 files changed

+40
-5
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8" />
55
<meta name="apple-mobile-web-app-capable" content="yes" />
6-
<meta name="generator" content="slidesdown 1.2.6" />
6+
<meta name="generator" content="slidesdown 1.2.7" />
77
<link href="https://slidesdown.github.io" rel="canonical" />
88
<meta content="Slidesdown" property="og:title" />
99
<meta content="Presentations at the speed of Markdown" name="description" />

plugin/slidesdown.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function addAttributeInElement(node, elementTarget, separator) {
6666
const attrsInNode = new RegExp(separator, "gm");
6767
const attrsRegex = new RegExp(
6868
// attributes are limited to prevent code injection
69-
/(?:^|\s+)(?<attr>class|style|data-[a-z-]+)=(?:"(?<dval>[^"]+?)"|'(?<sval>[^']+?)')/,
69+
/(?:^|\s+)(?<attr>un-cloak|class|style|data-[a-z-]+)=(?:"(?<dval>[^"]*)"|'(?<sval>[^']*)')/,
7070
"gm",
7171
);
7272
let matches,
@@ -167,7 +167,7 @@ function addSlidifyDefaultOptions(options) {
167167
return options;
168168
}
169169

170-
const IS_URL = /^https?:\/\//;
170+
const IS_URL = /^[a-z]+:/;
171171
const IS_ABSOLUTE = /^\//;
172172
const IS_LOCAL = /^#/;
173173
const IS_RELATIVE = /^(\.\.\/|\.\/)/;

plugin/slidesdown.test.js

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ describe("Basic parsing", () => {
121121
expect(section.children[0].textContent).toBe("world");
122122
});
123123

124-
test("When a an element and slide comment, then it adds attributes to the respective HTML elements.", async () => {
124+
test("When an element and slide comment, then it adds attributes to the respective HTML elements.", async () => {
125125
SECTION.setAttribute(
126126
"data-markdown-plain",
127127
[
128128
"# hello",
129129
'<!-- .slide: class="test-slide" style="color: red;" data-visibility="hidden" -->',
130130
'<!-- .element: style="color: green;" class="test-element" -->',
131131
"- list element",
132-
'- list element 2 <!-- .element: class="test-li" style="color: orange;"-->',
132+
'- list element 2 <!-- .element: un-cloak="" class="test-li" style="color: orange;"-->',
133133
'<!-- .element: class="test-ul" style="color: blue;"-->',
134134
].join("\n"),
135135
);
@@ -161,6 +161,7 @@ describe("Basic parsing", () => {
161161
expect(section.children[1].style.color).toBe("blue");
162162
expect(section.children[1].children.length).toBe(2);
163163
expect(section.children[1].children[1].getAttributeNames()).toEqual([
164+
"un-cloak",
164165
"class",
165166
"style",
166167
]);
@@ -560,6 +561,35 @@ describe("Relative URL rewriting", () => {
560561
`${markedOptions.baseUrl}test.png`,
561562
);
562563
});
564+
565+
test("When a URL is to provided, it is never rebased", async () => {
566+
SECTION.setAttribute(
567+
"data-markdown-plain",
568+
[
569+
"# hello",
570+
'<img src="https://test.example.com/test.png" />',
571+
'<a href="https://test.example.com/test.png">link</a>',
572+
'<a href="tel:0123458789">tel</a>',
573+
'<a href="mailto:[email protected]">mail</a>',
574+
].join("\n"),
575+
);
576+
const metadata = await preProcessSlides(DIV);
577+
expect(metadata).toStrictEqual({});
578+
await convertMarkdownToSlides(DIV, marked);
579+
expect(DIV.children.length).toBe(1);
580+
const section = DIV.children[0];
581+
expect(section.children.length).toBe(5);
582+
expect(section.children[1].getAttribute("src")).toBe(
583+
"https://test.example.com/test.png",
584+
);
585+
expect(section.children[2].getAttribute("href")).toBe(
586+
"https://test.example.com/test.png",
587+
);
588+
expect(section.children[3].getAttribute("href")).toBe("tel:0123458789");
589+
expect(section.children[4].getAttribute("href")).toBe(
590+
591+
);
592+
});
563593
});
564594

565595
describe("Security", () => {

styles.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/* Preventing FOUC https://unocss.dev/integrations/runtime */
2+
[un-cloak] {
3+
display: none;
4+
}
5+
16
/* FIX: hide customcontrols when printing slides, bug https://github.com/rajgoel/reveal.js-plugins/issues/159 */
27
@media print {
38
#customcontrols {

0 commit comments

Comments
 (0)