mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-06 20:55:21 +00:00
Use filters, as transforms has memory issues
This commit is contained in:
parent
e4500a6342
commit
b9f25858db
@ -109,7 +109,7 @@ module.exports = function(eleventyConfig) {
|
|||||||
|
|
||||||
eleventyConfig.setLibrary("md", markdownLib);
|
eleventyConfig.setLibrary("md", markdownLib);
|
||||||
|
|
||||||
eleventyConfig.addTransform('link', function(str) {
|
eleventyConfig.addFilter('link', function(str) {
|
||||||
return str && str.replace(/\[\[(.*?\|.*?)\]\]/g, function(match, p1) {
|
return str && str.replace(/\[\[(.*?\|.*?)\]\]/g, function(match, p1) {
|
||||||
//Check if it is an embedded excalidraw drawing or mathjax javascript
|
//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) {
|
||||||
@ -143,7 +143,7 @@ module.exports = function(eleventyConfig) {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
eleventyConfig.addTransform('highlight', function(str) {
|
eleventyConfig.addFilter('highlight', function(str) {
|
||||||
return str && str.replace(/\=\=(.*?)\=\=/g, function(match, p1) {
|
return str && str.replace(/\=\=(.*?)\=\=/g, function(match, p1) {
|
||||||
return `<mark>${p1}</mark>`;
|
return `<mark>${p1}</mark>`;
|
||||||
});
|
});
|
||||||
@ -155,7 +155,7 @@ module.exports = function(eleventyConfig) {
|
|||||||
let titleDiv = "";
|
let titleDiv = "";
|
||||||
let calloutType = "";
|
let calloutType = "";
|
||||||
const calloutMeta = /\[!(\w*)\](\s?.*)/g;
|
const calloutMeta = /\[!(\w*)\](\s?.*)/g;
|
||||||
if(!content.match(calloutMeta)){
|
if (!content.match(calloutMeta)) {
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ permalink: "notes/{{ page.fileSlug | slugify }}/"
|
|||||||
{% if dgHomeLink !== false%}
|
{% if dgHomeLink !== false%}
|
||||||
<a href="/">🏡 Back Home</a>
|
<a href="/">🏡 Back Home</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ content | safe}}
|
{{ content | link | highlight | safe}}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
{%include "components/notegrowthhistory.njk"%}
|
{%include "components/notegrowthhistory.njk"%}
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{%- for garden in collections.gardenEntry -%}
|
{%- for garden in collections.gardenEntry -%}
|
||||||
{{garden.templateContent | safe }}
|
{{garden.templateContent | link | highlight | safe }}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user