@diplodoc/transform 4.0.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.diplodoc.md +38 -0
- package/CHANGELOG.md +404 -0
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/README.ru.md +36 -0
- package/dist/css/yfm.css +736 -0
- package/dist/css/yfm.css.map +7 -0
- package/dist/css/yfm.min.css +2 -0
- package/dist/css/yfm.min.css.map +7 -0
- package/dist/js/code.d.ts +1 -0
- package/dist/js/cut.d.ts +1 -0
- package/dist/js/index.d.ts +5 -0
- package/dist/js/polyfill.d.ts +1 -0
- package/dist/js/tabs.d.ts +1 -0
- package/dist/js/term/index.d.ts +1 -0
- package/dist/js/term/utils.d.ts +10 -0
- package/dist/js/utils.d.ts +2 -0
- package/dist/js/yfm.js +432 -0
- package/dist/js/yfm.js.map +7 -0
- package/dist/js/yfm.min.js +2 -0
- package/dist/js/yfm.min.js.map +7 -0
- package/lib/getObject.d.ts +2 -0
- package/lib/getObject.js +11 -0
- package/lib/getObject.js.map +1 -0
- package/lib/headings.d.ts +4 -0
- package/lib/headings.js +73 -0
- package/lib/headings.js.map +1 -0
- package/lib/highlight.d.ts +3 -0
- package/lib/highlight.js +29 -0
- package/lib/highlight.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +35 -0
- package/lib/index.js.map +1 -0
- package/lib/liquid/conditions.d.ts +4 -0
- package/lib/liquid/conditions.js +181 -0
- package/lib/liquid/conditions.js.map +1 -0
- package/lib/liquid/cycles.d.ts +4 -0
- package/lib/liquid/cycles.js +160 -0
- package/lib/liquid/cycles.js.map +1 -0
- package/lib/liquid/errors.d.ts +3 -0
- package/lib/liquid/errors.js +13 -0
- package/lib/liquid/errors.js.map +1 -0
- package/lib/liquid/evaluation.d.ts +3 -0
- package/lib/liquid/evaluation.js +138 -0
- package/lib/liquid/evaluation.js.map +1 -0
- package/lib/liquid/filters.d.ts +9 -0
- package/lib/liquid/filters.js +22 -0
- package/lib/liquid/filters.js.map +1 -0
- package/lib/liquid/index.d.ts +9 -0
- package/lib/liquid/index.js +87 -0
- package/lib/liquid/index.js.map +1 -0
- package/lib/liquid/lexical.d.ts +14 -0
- package/lib/liquid/lexical.js +79 -0
- package/lib/liquid/lexical.js.map +1 -0
- package/lib/liquid/services/argv.d.ts +15 -0
- package/lib/liquid/services/argv.js +17 -0
- package/lib/liquid/services/argv.js.map +1 -0
- package/lib/liquid/sourceMap.d.ts +24 -0
- package/lib/liquid/sourceMap.js +56 -0
- package/lib/liquid/sourceMap.js.map +1 -0
- package/lib/liquid/substitutions.d.ts +2 -0
- package/lib/liquid/substitutions.js +36 -0
- package/lib/liquid/substitutions.js.map +1 -0
- package/lib/liquid/utils.d.ts +8 -0
- package/lib/liquid/utils.js +24 -0
- package/lib/liquid/utils.js.map +1 -0
- package/lib/log.d.ts +18 -0
- package/lib/log.js +54 -0
- package/lib/log.js.map +1 -0
- package/lib/md.d.ts +14 -0
- package/lib/md.js +96 -0
- package/lib/md.js.map +1 -0
- package/lib/plugins/anchors/collect.d.ts +5 -0
- package/lib/plugins/anchors/collect.js +81 -0
- package/lib/plugins/anchors/collect.js.map +1 -0
- package/lib/plugins/anchors/constants.d.ts +2 -0
- package/lib/plugins/anchors/constants.js +6 -0
- package/lib/plugins/anchors/constants.js.map +1 -0
- package/lib/plugins/anchors/index.d.ts +7 -0
- package/lib/plugins/anchors/index.js +134 -0
- package/lib/plugins/anchors/index.js.map +1 -0
- package/lib/plugins/changelog/collect.d.ts +8 -0
- package/lib/plugins/changelog/collect.js +50 -0
- package/lib/plugins/changelog/collect.js.map +1 -0
- package/lib/plugins/changelog/index.d.ts +6 -0
- package/lib/plugins/changelog/index.js +131 -0
- package/lib/plugins/changelog/index.js.map +1 -0
- package/lib/plugins/changelog/types.d.ts +10 -0
- package/lib/plugins/changelog/types.js +3 -0
- package/lib/plugins/changelog/types.js.map +1 -0
- package/lib/plugins/checkbox/checkbox.d.ts +7 -0
- package/lib/plugins/checkbox/checkbox.js +91 -0
- package/lib/plugins/checkbox/checkbox.js.map +1 -0
- package/lib/plugins/checkbox/index.d.ts +8 -0
- package/lib/plugins/checkbox/index.js +12 -0
- package/lib/plugins/checkbox/index.js.map +1 -0
- package/lib/plugins/code.d.ts +3 -0
- package/lib/plugins/code.js +61 -0
- package/lib/plugins/code.js.map +1 -0
- package/lib/plugins/cut.d.ts +3 -0
- package/lib/plugins/cut.js +70 -0
- package/lib/plugins/cut.js.map +1 -0
- package/lib/plugins/deflist.d.ts +3 -0
- package/lib/plugins/deflist.js +8 -0
- package/lib/plugins/deflist.js.map +1 -0
- package/lib/plugins/file/const.d.ts +27 -0
- package/lib/plugins/file/const.js +47 -0
- package/lib/plugins/file/const.js.map +1 -0
- package/lib/plugins/file/file.d.ts +8 -0
- package/lib/plugins/file/file.js +63 -0
- package/lib/plugins/file/file.js.map +1 -0
- package/lib/plugins/file/index.d.ts +4 -0
- package/lib/plugins/file/index.js +9 -0
- package/lib/plugins/file/index.js.map +1 -0
- package/lib/plugins/images/collect.d.ts +8 -0
- package/lib/plugins/images/collect.js +43 -0
- package/lib/plugins/images/collect.js.map +1 -0
- package/lib/plugins/images/index.d.ts +10 -0
- package/lib/plugins/images/index.js +81 -0
- package/lib/plugins/images/index.js.map +1 -0
- package/lib/plugins/imsize/const.d.ts +7 -0
- package/lib/plugins/imsize/const.js +12 -0
- package/lib/plugins/imsize/const.js.map +1 -0
- package/lib/plugins/imsize/helpers.d.ts +6 -0
- package/lib/plugins/imsize/helpers.js +64 -0
- package/lib/plugins/imsize/helpers.js.map +1 -0
- package/lib/plugins/imsize/index.d.ts +8 -0
- package/lib/plugins/imsize/index.js +12 -0
- package/lib/plugins/imsize/index.js.map +1 -0
- package/lib/plugins/imsize/plugin.d.ts +3 -0
- package/lib/plugins/imsize/plugin.js +188 -0
- package/lib/plugins/imsize/plugin.js.map +1 -0
- package/lib/plugins/includes/collect.d.ts +8 -0
- package/lib/plugins/includes/collect.js +49 -0
- package/lib/plugins/includes/collect.js.map +1 -0
- package/lib/plugins/includes/index.d.ts +8 -0
- package/lib/plugins/includes/index.js +98 -0
- package/lib/plugins/includes/index.js.map +1 -0
- package/lib/plugins/links/collect.d.ts +7 -0
- package/lib/plugins/links/collect.js +74 -0
- package/lib/plugins/links/collect.js.map +1 -0
- package/lib/plugins/links/constants.d.ts +1 -0
- package/lib/plugins/links/constants.js +5 -0
- package/lib/plugins/links/constants.js.map +1 -0
- package/lib/plugins/links/index.d.ts +24 -0
- package/lib/plugins/links/index.js +178 -0
- package/lib/plugins/links/index.js.map +1 -0
- package/lib/plugins/meta.d.ts +3 -0
- package/lib/plugins/meta.js +8 -0
- package/lib/plugins/meta.js.map +1 -0
- package/lib/plugins/monospace.d.ts +3 -0
- package/lib/plugins/monospace.js +109 -0
- package/lib/plugins/monospace.js.map +1 -0
- package/lib/plugins/notes.d.ts +3 -0
- package/lib/plugins/notes.js +103 -0
- package/lib/plugins/notes.js.map +1 -0
- package/lib/plugins/sup.d.ts +3 -0
- package/lib/plugins/sup.js +8 -0
- package/lib/plugins/sup.js.map +1 -0
- package/lib/plugins/table/index.d.ts +3 -0
- package/lib/plugins/table/index.js +215 -0
- package/lib/plugins/table/index.js.map +1 -0
- package/lib/plugins/tabs.d.ts +4 -0
- package/lib/plugins/tabs.js +4 -0
- package/lib/plugins/tabs.js.map +1 -0
- package/lib/plugins/term/constants.d.ts +1 -0
- package/lib/plugins/term/constants.js +5 -0
- package/lib/plugins/term/constants.js.map +1 -0
- package/lib/plugins/term/index.d.ts +3 -0
- package/lib/plugins/term/index.js +108 -0
- package/lib/plugins/term/index.js.map +1 -0
- package/lib/plugins/term/termDefinitions.d.ts +4 -0
- package/lib/plugins/term/termDefinitions.js +125 -0
- package/lib/plugins/term/termDefinitions.js.map +1 -0
- package/lib/plugins/typings.d.ts +12 -0
- package/lib/plugins/typings.js +3 -0
- package/lib/plugins/typings.js.map +1 -0
- package/lib/plugins/utils.d.ts +6 -0
- package/lib/plugins/utils.js +30 -0
- package/lib/plugins/utils.js.map +1 -0
- package/lib/plugins/video/const.d.ts +10 -0
- package/lib/plugins/video/const.js +22 -0
- package/lib/plugins/video/const.js.map +1 -0
- package/lib/plugins/video/index.d.ts +8 -0
- package/lib/plugins/video/index.js +104 -0
- package/lib/plugins/video/index.js.map +1 -0
- package/lib/plugins/video/parsers.d.ts +6 -0
- package/lib/plugins/video/parsers.js +64 -0
- package/lib/plugins/video/parsers.js.map +1 -0
- package/lib/plugins/video/types.d.ts +34 -0
- package/lib/plugins/video/types.js +3 -0
- package/lib/plugins/video/types.js.map +1 -0
- package/lib/plugins/video/utils.d.ts +2 -0
- package/lib/plugins/video/utils.js +25 -0
- package/lib/plugins/video/utils.js.map +1 -0
- package/lib/plugins.d.ts +3 -0
- package/lib/plugins.js +36 -0
- package/lib/plugins.js.map +1 -0
- package/lib/sanitize.d.ts +12 -0
- package/lib/sanitize.js +572 -0
- package/lib/sanitize.js.map +1 -0
- package/lib/title.d.ts +7 -0
- package/lib/title.js +18 -0
- package/lib/title.js.map +1 -0
- package/lib/typings.d.ts +57 -0
- package/lib/typings.js +3 -0
- package/lib/typings.js.map +1 -0
- package/lib/utils.d.ts +13 -0
- package/lib/utils.js +79 -0
- package/lib/utils.js.map +1 -0
- package/lib/utilsFS.d.ts +27 -0
- package/lib/utilsFS.js +89 -0
- package/lib/utilsFS.js.map +1 -0
- package/lib/yfmlint/index.d.ts +26 -0
- package/lib/yfmlint/index.js +72 -0
- package/lib/yfmlint/index.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/index.d.ts +9 -0
- package/lib/yfmlint/markdownlint-custom-rule/index.js +22 -0
- package/lib/yfmlint/markdownlint-custom-rule/index.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm001.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm001.js +28 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm001.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm002.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm002.js +33 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm002.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm003.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm003.js +33 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm003.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm004.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm004.js +28 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm004.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm005.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm005.js +28 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm005.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm006.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm006.js +28 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm006.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm007.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm007.js +29 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm007.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm008.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm008.js +28 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm008.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm009.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm009.js +47 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm009.js.map +1 -0
- package/lib/yfmlint/typings.d.ts +12 -0
- package/lib/yfmlint/typings.js +3 -0
- package/lib/yfmlint/typings.js.map +1 -0
- package/lib/yfmlint/utils.d.ts +9 -0
- package/lib/yfmlint/utils.js +22 -0
- package/lib/yfmlint/utils.js.map +1 -0
- package/lib/yfmlint/yfmlint.d.ts +3 -0
- package/lib/yfmlint/yfmlint.js +69 -0
- package/lib/yfmlint/yfmlint.js.map +1 -0
- package/package.json +106 -0
- package/src/.eslintrc +10 -0
- package/src/js/code.ts +65 -0
- package/src/js/cut.ts +57 -0
- package/src/js/index.ts +6 -0
- package/src/js/polyfill.js +27 -0
- package/src/js/term/index.ts +79 -0
- package/src/js/term/utils.ts +151 -0
- package/src/js/utils.ts +9 -0
- package/src/scss/_anchor.scss +33 -0
- package/src/scss/_code.scss +23 -0
- package/src/scss/_common.scss +407 -0
- package/src/scss/_cut.scss +42 -0
- package/src/scss/_file.scss +35 -0
- package/src/scss/_highlight.scss +96 -0
- package/src/scss/_note.scss +73 -0
- package/src/scss/_print.scss +20 -0
- package/src/scss/_term.scss +79 -0
- package/src/scss/_variables.scss +16 -0
- package/src/scss/yfm.scss +11 -0
- package/src/transform/getObject.ts +10 -0
- package/src/transform/headings.ts +88 -0
- package/src/transform/highlight.ts +33 -0
- package/src/transform/index.ts +50 -0
- package/src/transform/liquid/conditions.ts +259 -0
- package/src/transform/liquid/cycles.ts +244 -0
- package/src/transform/liquid/errors.ts +10 -0
- package/src/transform/liquid/evaluation.ts +145 -0
- package/src/transform/liquid/filters.ts +19 -0
- package/src/transform/liquid/index.ts +141 -0
- package/src/transform/liquid/lexical.ts +86 -0
- package/src/transform/liquid/services/argv.ts +23 -0
- package/src/transform/liquid/sourceMap.ts +72 -0
- package/src/transform/liquid/substitutions.ts +40 -0
- package/src/transform/liquid/utils.ts +30 -0
- package/src/transform/log.ts +60 -0
- package/src/transform/md.ts +123 -0
- package/src/transform/plugins/anchors/collect.ts +101 -0
- package/src/transform/plugins/anchors/constants.ts +2 -0
- package/src/transform/plugins/anchors/index.ts +166 -0
- package/src/transform/plugins/changelog/collect.ts +66 -0
- package/src/transform/plugins/changelog/index.ts +164 -0
- package/src/transform/plugins/changelog/types.ts +10 -0
- package/src/transform/plugins/checkbox/checkbox.ts +107 -0
- package/src/transform/plugins/checkbox/index.ts +15 -0
- package/src/transform/plugins/code.ts +79 -0
- package/src/transform/plugins/cut.ts +98 -0
- package/src/transform/plugins/deflist.ts +5 -0
- package/src/transform/plugins/file/README.md +34 -0
- package/src/transform/plugins/file/const.ts +46 -0
- package/src/transform/plugins/file/file.ts +82 -0
- package/src/transform/plugins/file/index.ts +10 -0
- package/src/transform/plugins/images/collect.ts +60 -0
- package/src/transform/plugins/images/index.ts +119 -0
- package/src/transform/plugins/imsize/const.ts +7 -0
- package/src/transform/plugins/imsize/helpers.ts +75 -0
- package/src/transform/plugins/imsize/index.ts +14 -0
- package/src/transform/plugins/imsize/plugin.ts +214 -0
- package/src/transform/plugins/includes/collect.ts +73 -0
- package/src/transform/plugins/includes/index.ts +127 -0
- package/src/transform/plugins/links/collect.ts +92 -0
- package/src/transform/plugins/links/constants.ts +1 -0
- package/src/transform/plugins/links/index.ts +218 -0
- package/src/transform/plugins/meta.ts +5 -0
- package/src/transform/plugins/monospace.ts +141 -0
- package/src/transform/plugins/notes.ts +134 -0
- package/src/transform/plugins/sup.ts +5 -0
- package/src/transform/plugins/table/index.ts +290 -0
- package/src/transform/plugins/tabs.ts +3 -0
- package/src/transform/plugins/term/constants.ts +1 -0
- package/src/transform/plugins/term/index.ts +139 -0
- package/src/transform/plugins/term/termDefinitions.ts +177 -0
- package/src/transform/plugins/typings.ts +14 -0
- package/src/transform/plugins/utils.ts +38 -0
- package/src/transform/plugins/video/const.ts +20 -0
- package/src/transform/plugins/video/index.ts +134 -0
- package/src/transform/plugins/video/parsers.ts +65 -0
- package/src/transform/plugins/video/types.ts +27 -0
- package/src/transform/plugins/video/utils.ts +24 -0
- package/src/transform/plugins.ts +35 -0
- package/src/transform/sanitize.ts +596 -0
- package/src/transform/title.ts +22 -0
- package/src/transform/typings.ts +64 -0
- package/src/transform/utils.ts +91 -0
- package/src/transform/utilsFS.ts +128 -0
- package/src/transform/yfmlint/README.md +48 -0
- package/src/transform/yfmlint/index.ts +124 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/index.ts +9 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm001.ts +36 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm002.ts +33 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm003.ts +33 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm004.ts +27 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm005.ts +27 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm006.ts +26 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm007.ts +28 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm008.ts +26 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm009.ts +54 -0
- package/src/transform/yfmlint/typings.ts +13 -0
- package/src/transform/yfmlint/utils.ts +31 -0
- package/src/transform/yfmlint/yfmlint.ts +73 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Process @[youtube](youtubeVideoID)
|
|
3
|
+
// Process @[vimeo](vimeoVideoID)
|
|
4
|
+
// Process @[vine](vineVideoID)
|
|
5
|
+
// Process @[prezi](preziID)
|
|
6
|
+
// Process @[osf](guid)
|
|
7
|
+
const parsers_1 = require("./parsers");
|
|
8
|
+
const const_1 = require("./const");
|
|
9
|
+
// eslint-disable-next-line valid-jsdoc
|
|
10
|
+
/**
|
|
11
|
+
* Video plugin for markdown-it.
|
|
12
|
+
* Forked from https://github.com/CenterForOpenScience/markdown-it-video/tree/0.6.3
|
|
13
|
+
*/
|
|
14
|
+
const video = (md, options) => {
|
|
15
|
+
const theOptions = Object.assign(Object.assign({}, const_1.defaults), options);
|
|
16
|
+
const theMd = md;
|
|
17
|
+
theMd.renderer.rules.video = tokenizeVideo(theMd, theOptions);
|
|
18
|
+
theMd.inline.ruler.before('emphasis', 'video', videoEmbed(theMd, theOptions));
|
|
19
|
+
};
|
|
20
|
+
function tokenizeVideo(md, options) {
|
|
21
|
+
return (tokens, idx) => {
|
|
22
|
+
const videoID = md.utils.escapeHtml(tokens[idx].videoID);
|
|
23
|
+
const service = md.utils.escapeHtml(tokens[idx].service).toLowerCase();
|
|
24
|
+
const checkUrl = /http(?:s?):\/\/(?:www\.)?[a-zA-Z0-9-:.]{1,}\/render(?:\/)?[a-zA-Z0-9.&;?=:%]{1,}url=http(?:s?):\/\/[a-zA-Z0-9 -:.]{1,}\/[a-zA-Z0-9]{1,5}\/\?[a-zA-Z0-9.=:%]{1,}/;
|
|
25
|
+
let num;
|
|
26
|
+
if (service === const_1.VideoService.Osf && videoID) {
|
|
27
|
+
num = Math.random() * 0x10000;
|
|
28
|
+
if (videoID.match(checkUrl)) {
|
|
29
|
+
return ('<div id="' +
|
|
30
|
+
num +
|
|
31
|
+
'" class="mfr mfr-file"></div><script>' +
|
|
32
|
+
'$(document).ready(function () {new mfr.Render("' +
|
|
33
|
+
num +
|
|
34
|
+
'", "' +
|
|
35
|
+
videoID +
|
|
36
|
+
'");' +
|
|
37
|
+
' }); </script>');
|
|
38
|
+
}
|
|
39
|
+
return ('<div id="' +
|
|
40
|
+
num +
|
|
41
|
+
'" class="mfr mfr-file"></div><script>' +
|
|
42
|
+
'$(document).ready(function () {new mfr.Render("' +
|
|
43
|
+
num +
|
|
44
|
+
'", "https://mfr.osf.io/' +
|
|
45
|
+
'render?url=https://osf.io/' +
|
|
46
|
+
videoID +
|
|
47
|
+
'/?action=download%26mode=render");' +
|
|
48
|
+
' }); </script>');
|
|
49
|
+
}
|
|
50
|
+
const { width, height } = options[service];
|
|
51
|
+
return videoID === ''
|
|
52
|
+
? ''
|
|
53
|
+
: '<div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item ' +
|
|
54
|
+
service +
|
|
55
|
+
'-player" type="text/html" width="' +
|
|
56
|
+
width +
|
|
57
|
+
'" height="' +
|
|
58
|
+
height +
|
|
59
|
+
'" src="' +
|
|
60
|
+
options.url(service, videoID, options) +
|
|
61
|
+
'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>';
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const EMBED_REGEX = /@\[([a-zA-Z].+)]\([\s]*(.*?)[\s]*[)]/im;
|
|
65
|
+
function videoEmbed(md, _options) {
|
|
66
|
+
return (state, silent) => {
|
|
67
|
+
const theState = state;
|
|
68
|
+
const oldPos = state.pos;
|
|
69
|
+
if (state.src.charCodeAt(oldPos) !== 0x40 /* @ */ ||
|
|
70
|
+
state.src.charCodeAt(oldPos + 1) !== 0x5b /* [ */) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
const match = EMBED_REGEX.exec(state.src.slice(state.pos, state.src.length));
|
|
74
|
+
if (!match || match.length < 3) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
const service = match[1];
|
|
78
|
+
const videoID = (0, parsers_1.parseVideoUrl)(service, match[2]);
|
|
79
|
+
if (videoID === false) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
const serviceStart = oldPos + 2;
|
|
83
|
+
const serviceEnd = md.helpers.parseLinkLabel(state, oldPos + 1, false);
|
|
84
|
+
//
|
|
85
|
+
// We found the end of the link, and know for a fact it's a valid link;
|
|
86
|
+
// so all that's left to do is to call tokenizer.
|
|
87
|
+
//
|
|
88
|
+
if (!silent) {
|
|
89
|
+
theState.pos = serviceStart;
|
|
90
|
+
// @ts-expect-error
|
|
91
|
+
theState.service = theState.src.slice(serviceStart, serviceEnd);
|
|
92
|
+
const newState = new theState.md.inline.State(service, theState.md, theState.env, []);
|
|
93
|
+
newState.md.inline.tokenize(newState);
|
|
94
|
+
const token = theState.push('video', '', 0);
|
|
95
|
+
token.videoID = videoID;
|
|
96
|
+
token.service = service;
|
|
97
|
+
token.level = theState.level;
|
|
98
|
+
}
|
|
99
|
+
theState.pos += theState.src.indexOf(')', theState.pos);
|
|
100
|
+
return true;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
module.exports = video;
|
|
104
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transform/plugins/video/index.ts"],"names":[],"mappings":";AAAA,qCAAqC;AACrC,iCAAiC;AACjC,+BAA+B;AAC/B,4BAA4B;AAC5B,uBAAuB;AAQvB,uCAAwC;AACxC,mCAA+C;AAE/C,uCAAuC;AACvC;;;GAGG;AACH,MAAM,KAAK,GAA0C,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE;IACjE,MAAM,UAAU,mCAAyB,gBAAQ,GAAK,OAAO,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,EAAE,CAAC;IAEjB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC9D,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;AAClF,CAAC,CAAC;AAEF,SAAS,aAAa,CAAC,EAAc,EAAE,OAAyB;IAC5D,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;QACnB,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAE,MAAM,CAAC,GAAG,CAAgB,CAAC,OAAO,CAAC,CAAC;QACzE,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAE,MAAM,CAAC,GAAG,CAAgB,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;QACvF,MAAM,QAAQ,GACV,iKAAiK,CAAC;QACtK,IAAI,GAAG,CAAC;QAER,IAAI,OAAO,KAAK,oBAAY,CAAC,GAAG,IAAI,OAAO,EAAE;YACzC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC;YAE9B,IAAI,OAAO,CAAC,KAAK,C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C;QAED,QAAQ,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;AACN,CAAC;AAED,iBAAS,KAAK,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function youtubeParser(url: string): string;
|
|
2
|
+
export declare function vimeoParser(url: string): string;
|
|
3
|
+
export declare function vineParser(url: string): string;
|
|
4
|
+
export declare function preziParser(url: string): string;
|
|
5
|
+
export declare function mfrParser(url: string): string;
|
|
6
|
+
export declare function parseVideoUrl(service: string, url: string): string | false;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseVideoUrl = exports.mfrParser = exports.preziParser = exports.vineParser = exports.vimeoParser = exports.youtubeParser = void 0;
|
|
4
|
+
const const_1 = require("./const");
|
|
5
|
+
const ytRegex = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/;
|
|
6
|
+
function youtubeParser(url) {
|
|
7
|
+
const match = url.match(ytRegex);
|
|
8
|
+
return match && match[7].length === 11 ? match[7] : url;
|
|
9
|
+
}
|
|
10
|
+
exports.youtubeParser = youtubeParser;
|
|
11
|
+
const vimeoRegex = /https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/;
|
|
12
|
+
function vimeoParser(url) {
|
|
13
|
+
const match = url.match(vimeoRegex);
|
|
14
|
+
return match && typeof match[3] === 'string' ? match[3] : url;
|
|
15
|
+
}
|
|
16
|
+
exports.vimeoParser = vimeoParser;
|
|
17
|
+
const vineRegex = /^http(?:s?):\/\/(?:www\.)?vine\.co\/v\/([a-zA-Z0-9]{1,13}).*/;
|
|
18
|
+
function vineParser(url) {
|
|
19
|
+
const match = url.match(vineRegex);
|
|
20
|
+
return match && match[1].length === 11 ? match[1] : url;
|
|
21
|
+
}
|
|
22
|
+
exports.vineParser = vineParser;
|
|
23
|
+
const preziRegex = /^https:\/\/prezi.com\/(.[^/]+)/;
|
|
24
|
+
function preziParser(url) {
|
|
25
|
+
const match = url.match(preziRegex);
|
|
26
|
+
return match ? match[1] : url;
|
|
27
|
+
}
|
|
28
|
+
exports.preziParser = preziParser;
|
|
29
|
+
// TODO: Write regex for staging and local servers.
|
|
30
|
+
const mfrRegex = /^http(?:s?):\/\/(?:www\.)?mfr\.osf\.io\/render\?url=http(?:s?):\/\/osf\.io\/([a-zA-Z0-9]{1,5})\/\?action=download/;
|
|
31
|
+
function mfrParser(url) {
|
|
32
|
+
const match = url.match(mfrRegex);
|
|
33
|
+
return match ? match[1] : url;
|
|
34
|
+
}
|
|
35
|
+
exports.mfrParser = mfrParser;
|
|
36
|
+
function parseVideoUrl(service, url) {
|
|
37
|
+
let videoID = '';
|
|
38
|
+
switch (service.toLowerCase()) {
|
|
39
|
+
case const_1.VideoService.YouTube:
|
|
40
|
+
videoID = youtubeParser(url);
|
|
41
|
+
break;
|
|
42
|
+
case const_1.VideoService.Vimeo:
|
|
43
|
+
videoID = vimeoParser(url);
|
|
44
|
+
break;
|
|
45
|
+
case const_1.VideoService.Vine:
|
|
46
|
+
videoID = vineParser(url);
|
|
47
|
+
break;
|
|
48
|
+
case const_1.VideoService.Prezi:
|
|
49
|
+
videoID = preziParser(url);
|
|
50
|
+
break;
|
|
51
|
+
case const_1.VideoService.Osf:
|
|
52
|
+
videoID = mfrParser(url);
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
// If the videoID field is empty, regex currently make it the close parenthesis.
|
|
58
|
+
if (videoID === ')') {
|
|
59
|
+
videoID = '';
|
|
60
|
+
}
|
|
61
|
+
return videoID;
|
|
62
|
+
}
|
|
63
|
+
exports.parseVideoUrl = parseVideoUrl;
|
|
64
|
+
//# sourceMappingURL=parsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../../src/transform/plugins/video/parsers.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAErC,MAAM,OAAO,GAAG,2EAA2E,CAAC;AAC5F,SAAgB,aAAa,CAAC,GAAW;IACrC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC5D,CAAC;AAHD,sCAGC;AAED,MAAM,UAAU,GACZ,oIAAoI,CAAC;AACzI,SAAgB,WAAW,CAAC,GAAW;IACnC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACpC,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC;AAHD,kCAGC;AAED,MAAM,SAAS,GAAG,8DAA8D,CAAC;AACjF,SAAgB,UAAU,CAAC,GAAW;IAClC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC5D,CAAC;AAHD,gCAGC;AAED,MAAM,UAAU,GAAG,gCAAgC,CAAC;AACpD,SAAgB,WAAW,CAAC,GAAW;IACnC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,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oService } from './const';
|
|
3
|
+
export declare type VideoToken = Token & {
|
|
4
|
+
service: string;
|
|
5
|
+
videoID: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type VideoServicesOptions = {
|
|
8
|
+
[VideoService.YouTube]: {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
[VideoService.Vimeo]: {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
[VideoService.Vine]: {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
embed: 'simple' | string;
|
|
20
|
+
};
|
|
21
|
+
[VideoService.Prezi]: {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
};
|
|
25
|
+
[VideoService.Osf]: {
|
|
26
|
+
width: string;
|
|
27
|
+
height: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare type VideoFullOptions = VideoServicesOptions & {
|
|
31
|
+
url: VideoUrlFn;
|
|
32
|
+
};
|
|
33
|
+
export declare type VideoPluginOptions = Partial<VideoFullOptions>;
|
|
34
|
+
export declare type VideoUrlFn = (service: string, videoID: string, options: VideoServicesOptions) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/transform/plugins/video/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.videoUrl = void 0;
|
|
4
|
+
const videoUrl = (service, videoID, options) => {
|
|
5
|
+
switch (service) {
|
|
6
|
+
case 'youtube':
|
|
7
|
+
return 'https://www.youtube.com/embed/' + videoID;
|
|
8
|
+
case 'vimeo':
|
|
9
|
+
return 'https://player.vimeo.com/video/' + videoID;
|
|
10
|
+
case 'vine':
|
|
11
|
+
return 'https://vine.co/v/' + videoID + '/embed/' + options.vine.embed;
|
|
12
|
+
case 'prezi':
|
|
13
|
+
return ('https://prezi.com/embed/' +
|
|
14
|
+
videoID +
|
|
15
|
+
'/?bgcolor=ffffff&lock_to_path=0&autoplay=0&autohide_ctrls=0&' +
|
|
16
|
+
'landing_data=bHVZZmNaNDBIWnNjdEVENDRhZDFNZGNIUE43MHdLNWpsdFJLb2ZHanI5N1lQVHkxSHFxazZ0UUNCRHloSXZROHh3PT0&' +
|
|
17
|
+
'landing_sign=1kD6c0N6aYpMUS0wxnQjxzSqZlEB8qNFdxtdjYhwSuI');
|
|
18
|
+
case 'osf':
|
|
19
|
+
return 'https://mfr.osf.io/render?url=https://osf.io/' + videoID + '/?action=download';
|
|
20
|
+
default:
|
|
21
|
+
return service;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.videoUrl = videoUrl;
|
|
25
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/transform/plugins/video/utils.ts"],"names":[],"mappings":";;;AAEO,MAAM,QAAQ,GAAe,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IAC9D,QAAQ,OAAO,EAAE;QACb,KAAK,SAAS;YACV,OAAO,gCAAgC,GAAG,OAAO,CAAC;QACtD,KAAK,OAAO;YACR,OAAO,iCAAiC,GAAG,OAAO,CAAC;QACvD,KAAK,MAAM;YACP,OAAO,oBAAoB,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAC3E,KAAK,OAAO;YACR,OAAO,CACH,0BAA0B;gBAC1B,OAAO;gBACP,8EAA8E;gBAC9E,+GAA+G;gBAC/G,0DAA0D,CAC7D,CAAC;QACN,KAAK,KAAK;YACN,OAAO,+CAA+C,GAAG,OAAO,GAAG,mBAAmB,CAAC;QAC3F;YACI,OAAO,OAAO,CAAC;KACtB;AACL,CAAC,CAAC;AArBW,QAAA,QAAQ,YAqBnB"}
|
package/lib/plugins.d.ts
ADDED
package/lib/plugins.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const meta_1 = __importDefault(require("./plugins/meta"));
|
|
6
|
+
const deflist_1 = __importDefault(require("./plugins/deflist"));
|
|
7
|
+
const cut_1 = __importDefault(require("./plugins/cut"));
|
|
8
|
+
const notes_1 = __importDefault(require("./plugins/notes"));
|
|
9
|
+
const anchors_1 = __importDefault(require("./plugins/anchors"));
|
|
10
|
+
const tabs_1 = __importDefault(require("./plugins/tabs"));
|
|
11
|
+
const code_1 = __importDefault(require("./plugins/code"));
|
|
12
|
+
const sup_1 = __importDefault(require("./plugins/sup"));
|
|
13
|
+
const video_1 = __importDefault(require("./plugins/video"));
|
|
14
|
+
const monospace_1 = __importDefault(require("./plugins/monospace"));
|
|
15
|
+
const table_1 = __importDefault(require("./plugins/table"));
|
|
16
|
+
const file_1 = __importDefault(require("./plugins/file"));
|
|
17
|
+
const imsize_1 = __importDefault(require("./plugins/imsize"));
|
|
18
|
+
const term_1 = __importDefault(require("./plugins/term"));
|
|
19
|
+
const defaultPlugins = [
|
|
20
|
+
meta_1.default,
|
|
21
|
+
deflist_1.default,
|
|
22
|
+
cut_1.default,
|
|
23
|
+
notes_1.default,
|
|
24
|
+
anchors_1.default,
|
|
25
|
+
tabs_1.default,
|
|
26
|
+
code_1.default,
|
|
27
|
+
sup_1.default,
|
|
28
|
+
video_1.default,
|
|
29
|
+
monospace_1.default,
|
|
30
|
+
table_1.default,
|
|
31
|
+
file_1.default,
|
|
32
|
+
imsize_1.default,
|
|
33
|
+
term_1.default,
|
|
34
|
+
];
|
|
35
|
+
module.exports = defaultPlugins;
|
|
36
|
+
//# sourceMappingURL=plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../src/transform/plugins.ts"],"names":[],"mappings":";;;;AAEA,0DAAkC;AAClC,gEAAwC;AACxC,wDAAgC;AAChC,4DAAoC;AACpC,gEAAwC;AACxC,0DAAkC;AAClC,0DAAkC;AAClC,wDAAgC;AAChC,4DAAoC;AACpC,oEAA4C;AAC5C,4DAAuC;AACvC,0DAAkC;AAClC,8DAAsC;AACtC,0DAAkC;AAElC,MAAM,cAAc,GAAG;IACnB,cAAI;IACJ,iBAAO;IACP,aAAG;IACH,eAAK;IACL,iBAAO;IACP,cAAI;IACJ,cAAI;IACJ,aAAG;IACH,eAAK;IACL,mBAAS;IACT,eAAQ;IACR,cAAI;IACJ,gBAAM;IACN,cAAI;CACiB,CAAC;AAE1B,iBAAS,cAAc,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import sanitizeHtml from 'sanitize-html';
|
|
2
|
+
export declare type CssWhiteList = {
|
|
3
|
+
[property: string]: boolean;
|
|
4
|
+
};
|
|
5
|
+
export interface SanitizeOptions extends sanitizeHtml.IOptions {
|
|
6
|
+
cssWhiteList?: CssWhiteList;
|
|
7
|
+
}
|
|
8
|
+
export declare const defaultParseOptions: {
|
|
9
|
+
lowerCaseAttributeNames: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const defaultOptions: SanitizeOptions;
|
|
12
|
+
export default function sanitize(html: string, options?: SanitizeOptions): string;
|