mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-04 12:00:02 +00:00
Add support for empty admonition title and checkboxes
This commit is contained in:
parent
061618e88a
commit
5cc21ac870
19
.eleventy.js
19
.eleventy.js
@ -10,6 +10,14 @@ module.exports = function(eleventyConfig) {
|
||||
html: true
|
||||
})
|
||||
.use(require("markdown-it-footnote"))
|
||||
.use(require('markdown-it-task-checkbox'), {
|
||||
disabled: true,
|
||||
divWrap: false,
|
||||
divClass: 'checkbox',
|
||||
idPrefix: 'cbx_',
|
||||
ulClass: 'task-list',
|
||||
liClass: 'task-list-item'
|
||||
})
|
||||
.use(function(md) {
|
||||
//https://github.com/DCsunset/markdown-it-mermaid-plugin
|
||||
const origFenceRule = md.renderer.rules.fence || function(tokens, idx, options, env, self) {
|
||||
@ -28,8 +36,9 @@ module.exports = function(eleventyConfig) {
|
||||
if (token.info.startsWith("ad-")) {
|
||||
const code = token.content.trim();
|
||||
if (code && code.toLowerCase().startsWith("title:")) {
|
||||
const title = `<div class="admonition-title">${code.substring(6, code.indexOf("\n"))}</div>`;
|
||||
return `<div class="language-${token.info} admonition admonition-example admonition-plugin">${title}${md.render(code.slice(code.indexOf("\n")))}</div>`;
|
||||
const title = code.substring(6, code.indexOf("\n"));
|
||||
const titleDiv = title ? `<div class="admonition-title">${title}</div>` : '';
|
||||
return `<div class="language-${token.info} admonition admonition-example admonition-plugin">${titleDiv}${md.render(code.slice(code.indexOf("\n")))}</div>`;
|
||||
}
|
||||
|
||||
const title = `<div class="admonition-title">${token.info.charAt(3).toUpperCase()}${token.info.substring(4).toLowerCase()}</div>`;
|
||||
@ -91,7 +100,7 @@ module.exports = function(eleventyConfig) {
|
||||
eleventyConfig.addTransform('link', function(str) {
|
||||
return str && str.replace(/\[\[(.*?)\]\]/g, function(match, p1) {
|
||||
//Check if it is an embedded excalidraw drawing or mathjax javascript
|
||||
if (p1.indexOf("],[") > -1 || p1.indexOf('"$"')>-1) {
|
||||
if (p1.indexOf("],[") > -1 || p1.indexOf('"$"') > -1) {
|
||||
return match;
|
||||
}
|
||||
const [fileName, linkTitle] = p1.split("|");
|
||||
@ -120,7 +129,7 @@ module.exports = function(eleventyConfig) {
|
||||
});
|
||||
|
||||
eleventyConfig.addPassthroughCopy("src/site/img");
|
||||
eleventyConfig.addPlugin(faviconPlugin, {destination: 'dist'});
|
||||
eleventyConfig.addPlugin(faviconPlugin, { destination: 'dist' });
|
||||
|
||||
return {
|
||||
dir: {
|
||||
@ -134,4 +143,4 @@ module.exports = function(eleventyConfig) {
|
||||
passthroughFileCopy: true,
|
||||
};
|
||||
|
||||
};
|
||||
};
|
13
package-lock.json
generated
13
package-lock.json
generated
@ -17,7 +17,8 @@
|
||||
"eleventy-favicon": "^1.1.2",
|
||||
"gray-matter": "^4.0.3",
|
||||
"markdown-it": "^12.3.2",
|
||||
"markdown-it-footnote": "^3.0.3"
|
||||
"markdown-it-footnote": "^3.0.3",
|
||||
"markdown-it-task-checkbox": "^1.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@11ty/eleventy": "^1.0.0",
|
||||
@ -3304,6 +3305,11 @@
|
||||
"resolved": "https://registry.npmjs.org/markdown-it-footnote/-/markdown-it-footnote-3.0.3.tgz",
|
||||
"integrity": "sha512-YZMSuCGVZAjzKMn+xqIco9d1cLGxbELHZ9do/TSYVzraooV8ypsppKNmUJ0fVH5ljkCInQAtFpm8Rb3eXSrt5w=="
|
||||
},
|
||||
"node_modules/markdown-it-task-checkbox": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it-task-checkbox/-/markdown-it-task-checkbox-1.0.6.tgz",
|
||||
"integrity": "sha512-7pxkHuvqTOu3iwVGmDPeYjQg+AIS9VQxzyLP9JCg9lBjgPAJXGEkChK6A2iFuj3tS0GV3HG2u5AMNhcQqwxpJw=="
|
||||
},
|
||||
"node_modules/markdown-it/node_modules/argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
@ -8755,6 +8761,11 @@
|
||||
"resolved": "https://registry.npmjs.org/markdown-it-footnote/-/markdown-it-footnote-3.0.3.tgz",
|
||||
"integrity": "sha512-YZMSuCGVZAjzKMn+xqIco9d1cLGxbELHZ9do/TSYVzraooV8ypsppKNmUJ0fVH5ljkCInQAtFpm8Rb3eXSrt5w=="
|
||||
},
|
||||
"markdown-it-task-checkbox": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it-task-checkbox/-/markdown-it-task-checkbox-1.0.6.tgz",
|
||||
"integrity": "sha512-7pxkHuvqTOu3iwVGmDPeYjQg+AIS9VQxzyLP9JCg9lBjgPAJXGEkChK6A2iFuj3tS0GV3HG2u5AMNhcQqwxpJw=="
|
||||
},
|
||||
"maximatch": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/maximatch/-/maximatch-0.1.0.tgz",
|
||||
|
@ -29,6 +29,7 @@
|
||||
"eleventy-favicon": "^1.1.2",
|
||||
"gray-matter": "^4.0.3",
|
||||
"markdown-it": "^12.3.2",
|
||||
"markdown-it-footnote": "^3.0.3"
|
||||
"markdown-it-footnote": "^3.0.3",
|
||||
"markdown-it-task-checkbox": "^1.0.6"
|
||||
}
|
||||
}
|
||||
|
@ -31,16 +31,13 @@ div.translusion {
|
||||
}
|
||||
|
||||
.admonition-title {
|
||||
position: absolute;
|
||||
top: 16px;
|
||||
left: 55px;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
div[class*="language-ad-"]::before {
|
||||
display: block;
|
||||
div[class*="language-ad-"] .admonition-title::befforee {
|
||||
font-size: 1.4rem;
|
||||
margin-bottom: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
code[class*="language-ad-"] {
|
||||
@ -56,6 +53,11 @@ code[class*="language-ad-"] {
|
||||
color: rgb(230, 230, 230);
|
||||
}
|
||||
|
||||
ul.task-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div[class*="language-ad-"] {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
word-wrap: break-word;
|
||||
@ -71,115 +73,115 @@ div[class*="language-ad-"] {
|
||||
white-space: normal !important;
|
||||
}
|
||||
|
||||
div.language-ad-note::before {
|
||||
div.language-ad-note .admonition-title::before {
|
||||
content: "🖊️";
|
||||
}
|
||||
|
||||
div.language-ad-tip::before {
|
||||
div.language-ad-tip .admonition-title::before {
|
||||
content: "💡";
|
||||
}
|
||||
|
||||
div.language-ad-warning::before {
|
||||
div.language-ad-warning .admonition-title::before {
|
||||
content: "⚠️";
|
||||
}
|
||||
|
||||
div.language-ad-important::before {
|
||||
div.language-ad-important .admonition-title::before {
|
||||
content: "❗️";
|
||||
}
|
||||
|
||||
div.language-ad-caution::before {
|
||||
div.language-ad-caution .admonition-title::before {
|
||||
content: "⚠️";
|
||||
}
|
||||
|
||||
div.language-ad-info::before {
|
||||
div.language-ad-info .admonition-title::before {
|
||||
content: "ℹ";
|
||||
}
|
||||
|
||||
div.language-ad-example::before {
|
||||
div.language-ad-example .admonition-title::before {
|
||||
content: "🗒️";
|
||||
}
|
||||
|
||||
div.language-ad-seealso::before {
|
||||
div.language-ad-seealso .admonition-title::before {
|
||||
content: "🖊️";
|
||||
}
|
||||
|
||||
div.language-ad-abstract::before {
|
||||
div.language-ad-abstract .admonition-title::before {
|
||||
content: '📚'
|
||||
}
|
||||
|
||||
div.language-ad-summary::before {
|
||||
div.language-ad-summary .admonition-title::before {
|
||||
content: '📚'
|
||||
}
|
||||
|
||||
div.language-ad-tldr::before {
|
||||
div.language-ad-tldr .admonition-title::before {
|
||||
content: '📚'
|
||||
}
|
||||
|
||||
div.language-ad-todo::before {
|
||||
div.language-ad-todo .admonition-title::before {
|
||||
content: '☑️'
|
||||
}
|
||||
|
||||
div.language-ad-hint::before {
|
||||
div.language-ad-hint .admonition-title::before {
|
||||
content: '🔥'
|
||||
}
|
||||
|
||||
div.language-ad-success::before {
|
||||
div.language-ad-success .admonition-title::before {
|
||||
content: ✅
|
||||
}
|
||||
|
||||
div.language-ad-check::before {
|
||||
div.language-ad-check .admonition-title::before {
|
||||
content: '✅'
|
||||
}
|
||||
|
||||
div.language-ad-done::before {
|
||||
div.language-ad-done .admonition-title::before {
|
||||
content: '✅'
|
||||
}
|
||||
|
||||
div.language-ad-question::before {
|
||||
div.language-ad-question .admonition-title::before {
|
||||
content: '❓'
|
||||
}
|
||||
|
||||
div.language-ad-help::before {
|
||||
div.language-ad-help .admonition-title::before {
|
||||
content: '❓'
|
||||
}
|
||||
|
||||
div.language-ad-faq::before {
|
||||
div.language-ad-faq .admonition-title::before {
|
||||
content: '❓'
|
||||
}
|
||||
|
||||
div.language-ad-attention::before {
|
||||
div.language-ad-attention .admonition-title::before {
|
||||
content: '⚠️'
|
||||
}
|
||||
|
||||
div.language-ad-failure::before {
|
||||
div.language-ad-failure .admonition-title::before {
|
||||
content: '❌'
|
||||
}
|
||||
|
||||
div.language-ad-fail::before {
|
||||
div.language-ad-fail .admonition-title::before {
|
||||
content: '❌'
|
||||
}
|
||||
|
||||
div.language-ad-missing::before {
|
||||
div.language-ad-missing .admonition-title::before {
|
||||
content: '❌'
|
||||
}
|
||||
|
||||
div.language-ad-danger::before {
|
||||
div.language-ad-danger .admonition-title::before {
|
||||
content: '⚡'
|
||||
}
|
||||
|
||||
div.language-ad-error::before {
|
||||
div.language-ad-error .admonition-title::before {
|
||||
content: '⚡'
|
||||
}
|
||||
|
||||
div.language-ad-bug::before {
|
||||
div.language-ad-bug .admonition-title::before {
|
||||
content: '🐞'
|
||||
}
|
||||
|
||||
div.language-ad-quote::before {
|
||||
div.language-ad-quote .admonition-title::before {
|
||||
content: '💬'
|
||||
}
|
||||
|
||||
div.language-ad-cite::before {
|
||||
div.language-ad-cite .admonition-title::before {
|
||||
content: '💬'
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user