mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-04 12:00:02 +00:00
Use markdownit as only highlighter
This commit is contained in:
parent
66a4bdbe50
commit
406ae3de6b
28
.eleventy.js
28
.eleventy.js
@ -1,10 +1,10 @@
|
||||
const eleventyPluginSyntaxHighlighter = require('@11ty/eleventy-plugin-syntaxhighlight');
|
||||
|
||||
module.exports = function (eleventyConfig) {
|
||||
|
||||
let markdownIt = require("markdown-it");
|
||||
let markdownLib = markdownIt({
|
||||
html: true,
|
||||
breaks: true,
|
||||
html: true
|
||||
}).use(function (md) {
|
||||
//https://github.com/DCsunset/markdown-it-mermaid-plugin
|
||||
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 classIndex = tokens[idx].attrIndex('class');
|
||||
|
||||
|
||||
if (aIndex < 0) {
|
||||
tokens[idx].attrPush(['target', '_blank']);
|
||||
tokens[idx].attrPush(['target', '_blank']);
|
||||
} else {
|
||||
tokens[idx].attrs[aIndex][1] = '_blank';
|
||||
}
|
||||
|
||||
if (classIndex< 0) {
|
||||
tokens[idx].attrPush(['class', 'external-link']);
|
||||
if (aIndex < 0) {
|
||||
tokens[idx].attrPush(['target', '_blank']);
|
||||
} 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);
|
||||
};
|
||||
});
|
||||
@ -58,19 +61,6 @@ module.exports = function (eleventyConfig) {
|
||||
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 {
|
||||
dir: {
|
||||
input: "src/site",
|
||||
|
15417
package-lock.json
generated
15417
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -16,10 +16,9 @@
|
||||
"cross-env": "^7.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0",
|
||||
"@azure/storage-blob": "^12.8.0",
|
||||
"@octokit/core": "^3.5.1",
|
||||
"dotenv": "^10.0.0",
|
||||
"markdown-it": "^12.3.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user