mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-06 20:55:21 +00:00
Use markdownit as only highlighter
This commit is contained in:
parent
66a4bdbe50
commit
406ae3de6b
26
.eleventy.js
26
.eleventy.js
@ -1,10 +1,10 @@
|
|||||||
const eleventyPluginSyntaxHighlighter = require('@11ty/eleventy-plugin-syntaxhighlight');
|
|
||||||
|
|
||||||
module.exports = function (eleventyConfig) {
|
module.exports = function (eleventyConfig) {
|
||||||
|
|
||||||
let markdownIt = require("markdown-it");
|
let markdownIt = require("markdown-it");
|
||||||
let markdownLib = markdownIt({
|
let markdownLib = markdownIt({
|
||||||
html: true,
|
breaks: true,
|
||||||
|
html: true
|
||||||
}).use(function (md) {
|
}).use(function (md) {
|
||||||
//https://github.com/DCsunset/markdown-it-mermaid-plugin
|
//https://github.com/DCsunset/markdown-it-mermaid-plugin
|
||||||
const origRule = md.renderer.rules.fence.bind(md.renderer.rules);
|
const origRule = md.renderer.rules.fence.bind(md.renderer.rules);
|
||||||
@ -35,18 +35,21 @@ module.exports = function (eleventyConfig) {
|
|||||||
const aIndex = tokens[idx].attrIndex('target');
|
const aIndex = tokens[idx].attrIndex('target');
|
||||||
const classIndex = tokens[idx].attrIndex('class');
|
const classIndex = tokens[idx].attrIndex('class');
|
||||||
|
|
||||||
|
|
||||||
if (aIndex < 0) {
|
if (aIndex < 0) {
|
||||||
tokens[idx].attrPush(['target', '_blank']);
|
tokens[idx].attrPush(['target', '_blank']);
|
||||||
} else {
|
} else {
|
||||||
tokens[idx].attrs[aIndex][1] = '_blank';
|
tokens[idx].attrs[aIndex][1] = '_blank';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (classIndex< 0) {
|
if (aIndex < 0) {
|
||||||
tokens[idx].attrPush(['class', 'external-link']);
|
tokens[idx].attrPush(['target', '_blank']);
|
||||||
} else {
|
} else {
|
||||||
tokens[idx].attrs[classIndex][1] = 'external-link';
|
tokens[idx].attrs[aIndex][1] = '_blank';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tokens[idx].attrPush(['class', '_blank']);
|
||||||
|
|
||||||
return defaultRender(tokens, idx, options, env, self);
|
return defaultRender(tokens, idx, options, env, self);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -58,19 +61,6 @@ module.exports = function (eleventyConfig) {
|
|||||||
return str && str.replace(/\[\[(.*?)\]\]/g, '<a class="internal-link" href="/notes/$1">$1</a>');
|
return str && str.replace(/\[\[(.*?)\]\]/g, '<a class="internal-link" href="/notes/$1">$1</a>');
|
||||||
})
|
})
|
||||||
|
|
||||||
eleventyConfig.addPlugin(eleventyPluginSyntaxHighlighter, {
|
|
||||||
init: function ({ Prism }) {
|
|
||||||
Prism.languages['ad-note'] = Prism.languages.extend("markup", {});
|
|
||||||
Prism.languages['ad-tip'] = Prism.languages.extend("markup", {});
|
|
||||||
Prism.languages['ad-warning'] = Prism.languages.extend("markup", {});
|
|
||||||
Prism.languages['ad-caution'] = Prism.languages.extend("markup", {});
|
|
||||||
Prism.languages['ad-important'] = Prism.languages.extend("markup", {});
|
|
||||||
Prism.languages['ad-info'] = Prism.languages.extend("markup", {});
|
|
||||||
Prism.languages['transclusion'] = Prism.languages.extend("markup", {});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dir: {
|
dir: {
|
||||||
input: "src/site",
|
input: "src/site",
|
||||||
|
1391
package-lock.json
generated
1391
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,6 @@
|
|||||||
"cross-env": "^7.0.3"
|
"cross-env": "^7.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0",
|
|
||||||
"@azure/storage-blob": "^12.8.0",
|
"@azure/storage-blob": "^12.8.0",
|
||||||
"@octokit/core": "^3.5.1",
|
"@octokit/core": "^3.5.1",
|
||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user