correct links
This commit is contained in:
1 parent
34a178a958
commit
39d6b337e6
10 files changed
+59
-25
No files matched your search
Generated
+5
@@ -6305,6 +6305,11 @@
|
|||||||
"repeating": "^2.0.0"
|
"repeating": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"indented-filter": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/indented-filter/-/indented-filter-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-usPQg1fmF5JOAjg3VKHrhd7gcXaN4PuCIeyLf88/AnxZIAhys9ruuPwB2ww40eHKcz72+mMSg7Z/GVO2V5WXHQ=="
|
||||||
|
},
|
||||||
"indexes-of": {
|
"indexes-of": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npm.taobao.org/indexes-of/download/indexes-of-1.0.1.tgz",
|
"resolved": "https://registry.npm.taobao.org/indexes-of/download/indexes-of-1.0.1.tgz",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"gray-matter": "^4.0.2",
|
"gray-matter": "^4.0.2",
|
||||||
"hyperpug": "^0.1.7",
|
"hyperpug": "^0.1.7",
|
||||||
"hyperscript": "^2.0.2",
|
"hyperscript": "^2.0.2",
|
||||||
|
"indented-filter": "^0.1.0",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"showdown": "^1.9.0",
|
"showdown": "^1.9.0",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
</noscript>
|
</noscript>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
|
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
|
||||||
|
<script src="https://patarapolw.github.io/s2speak/index.min.js" charset="utf-8"></script>
|
||||||
<!-- built files will be auto injected -->
|
<!-- built files will be auto injected -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -8,6 +8,6 @@ tag:
|
|||||||
|
|
||||||
### Sentence quiz
|
### Sentence quiz
|
||||||
|
|
||||||
Please see [`slide:github:patarapolw/zhdiary/slides/句子1.1.md`](slide:github:patarapolw/zhdiary/slides/句子1.1.md)
|
Please see ^^slide(github="patarapolw/zh-slides") slides/句子1.1.md
|
||||||
|
|
||||||
Highlight text and press "x" inside the presentation to speak.
|
Highlight text and press "x" inside the presentation to speak.
|
||||||
@@ -8,6 +8,6 @@ tag:
|
|||||||
|
|
||||||
### Sentence quiz
|
### Sentence quiz
|
||||||
|
|
||||||
Please see [`slide:github:patarapolw/zhdiary/slides/句子1.2.md`](slide:github:patarapolw/zhdiary/slides/句子1.2.md)
|
Please see ^^slide(github="patarapolw/zh-slides") slides/句子1.2.md
|
||||||
|
|
||||||
Highlight text and press "x" inside the presentation to speak.
|
Highlight text and press "x" inside the presentation to speak.
|
||||||
@@ -8,6 +8,6 @@ tag:
|
|||||||
|
|
||||||
### Sentence quiz
|
### Sentence quiz
|
||||||
|
|
||||||
Please see [`slide:github:patarapolw/zhdiary/slides/句子1.3.md`](slide:github:patarapolw/zhdiary/slides/句子1.3.md)
|
Please see ^^slide(github="patarapolw/zh-slides") slides/句子1.3.md
|
||||||
|
|
||||||
Highlight text and press "x" inside the presentation to speak.
|
Highlight text and press "x" inside the presentation to speak.
|
||||||
@@ -11,7 +11,7 @@ tag:
|
|||||||
|
|
||||||
### Sentence quiz
|
### Sentence quiz
|
||||||
|
|
||||||
Please see [`slide:github:patarapolw/zhdiary/slides/身体1.md`](slide:github:patarapolw/zhdiary/slides/身体1.md)
|
Please see ^^slide(github="patarapolw/zh-slides") slides/身体1.md
|
||||||
|
|
||||||
Highlight text and press "x" inside the presentation to speak.
|
Highlight text and press "x" inside the presentation to speak.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ async function gAnalytics(id: string) {
|
|||||||
s.setAttribute('data-timestamp', new Date().toISOString());
|
s.setAttribute('data-timestamp', new Date().toISOString());
|
||||||
(d.head || d.body).appendChild(s);
|
(d.head || d.body).appendChild(s);
|
||||||
|
|
||||||
(window as any).dataLayer = dataLayer || [];
|
(window as any).dataLayer = (window as any).dataLayer || [];
|
||||||
function gtag(...x: any[]){dataLayer.push(arguments);}
|
function gtag(...x: any[]){dataLayer.push(arguments);}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
gtag('config', id);
|
gtag('config', id);
|
||||||
|
|||||||
+3
-20
@@ -1,30 +1,13 @@
|
|||||||
import showdown from "showdown";
|
import showdown from "showdown";
|
||||||
import h from "hyperscript";
|
import { slideExt, simpleTableExt } from "./showdown-ext";
|
||||||
|
|
||||||
export class Markdown {
|
export class Markdown {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.converter = new showdown.Converter({
|
this.converter = new showdown.Converter({
|
||||||
parseImgDimensions: true
|
parseImgDimensions: true,
|
||||||
|
extensions: [simpleTableExt, slideExt]
|
||||||
});
|
});
|
||||||
this.converter.setFlavor("github");
|
this.converter.setFlavor("github");
|
||||||
this.converter.addExtension({
|
|
||||||
type: "lang",
|
|
||||||
filter(text) {
|
|
||||||
const rowRegex = /(?:(?:^|\r?\n)(?:\| )?(?:(?:.* \| )+.+)*(?:.* \| )+.+(?: \|)?(?:$|\r?\n))+/m;
|
|
||||||
|
|
||||||
text = text.replace(rowRegex, (p0) => {
|
|
||||||
return h("table.table", p0.trim().split("\n").map((pi) => {
|
|
||||||
pi = pi.trim().replace(/^|/, "").replace(/|$/, "")
|
|
||||||
|
|
||||||
return h("tr", pi.split(" | ").map((x) => x.trim()).map((qi) => {
|
|
||||||
return h("td", qi);
|
|
||||||
}))
|
|
||||||
})).outerHTML;
|
|
||||||
});
|
|
||||||
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
md2html(md) {
|
md2html(md) {
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import { createIndentedFilter } from "indented-filter";
|
||||||
|
import h from "hyperscript";
|
||||||
|
|
||||||
|
export const simpleTableExt = {
|
||||||
|
type: "lang",
|
||||||
|
filter(text) {
|
||||||
|
const rowRegex = /(?:(?:^|\r?\n)(?:\| )?(?:(?:.* \| )+.+)*(?:.* \| )+.+(?: \|)?(?:$|\r?\n))+/m;
|
||||||
|
|
||||||
|
text = text.replace(rowRegex, (p0) => {
|
||||||
|
return h("table.table", p0.trim().split("\n").map((pi) => {
|
||||||
|
pi = pi.trim().replace(/^|/, "").replace(/|$/, "")
|
||||||
|
|
||||||
|
return h("tr", pi.split(" | ").map((x) => x.trim()).map((qi) => {
|
||||||
|
return h("td", qi);
|
||||||
|
}))
|
||||||
|
})).outerHTML;
|
||||||
|
});
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const slideExt = {
|
||||||
|
type: "lang",
|
||||||
|
filter: createIndentedFilter("^^slide", (s, attrs) => {
|
||||||
|
const a = document.createElement("a");
|
||||||
|
const url = new URL("https://reveal-md.herokuapp.com/");
|
||||||
|
let q = "";
|
||||||
|
if (attrs.github) {
|
||||||
|
q = `https://raw.githubusercontent.com/${attrs.github}/master/${s}`;
|
||||||
|
a.innerText = `github::${attrs.github}::${s}`;
|
||||||
|
} else {
|
||||||
|
q = s;
|
||||||
|
a.innerText = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
url.searchParams.append("q", q);
|
||||||
|
a.href = url.href;
|
||||||
|
a.alt = s;
|
||||||
|
a.target = "_blank";
|
||||||
|
|
||||||
|
return a.outerHTML;
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in new issue
Block a user