mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-06 20:55:21 +00:00
Hide dataview variable (#54)
* hide dataview variable * Update note.njk --------- Co-authored-by: Ole Eskild Steensen <oleeskild@users.noreply.github.com>
This commit is contained in:
parent
6f876c9246
commit
db6d4bb79b
34
.eleventy.js
34
.eleventy.js
@ -195,22 +195,15 @@ module.exports = function (eleventyConfig) {
|
|||||||
eleventyConfig.addFilter("taggify", function (str) {
|
eleventyConfig.addFilter("taggify", function (str) {
|
||||||
return (
|
return (
|
||||||
str &&
|
str &&
|
||||||
str.replace(
|
str.replace(tagRegex, function (match, precede, tag) {
|
||||||
tagRegex,
|
return `${precede}<a class="tag" onclick="toggleTagSearch(this)">${tag}</a>`;
|
||||||
function (match, precede, tag) {
|
})
|
||||||
return `${precede}<a class="tag" onclick="toggleTagSearch(this)">${tag}</a>`;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
eleventyConfig.addFilter("searchableTags", function (str) {
|
eleventyConfig.addFilter("searchableTags", function (str) {
|
||||||
let tags;
|
let tags;
|
||||||
let match =
|
let match = str && str.match(tagRegex);
|
||||||
str &&
|
|
||||||
str.match(
|
|
||||||
tagRegex,
|
|
||||||
);
|
|
||||||
if (match) {
|
if (match) {
|
||||||
tags = match
|
tags = match
|
||||||
.map((m) => {
|
.map((m) => {
|
||||||
@ -225,6 +218,15 @@ module.exports = function (eleventyConfig) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
eleventyConfig.addFilter("hideDataview", function (str) {
|
||||||
|
return (
|
||||||
|
str &&
|
||||||
|
str.replace(/\(\S+\:\:(.*)\)/g, function (_, value) {
|
||||||
|
return value.trim();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
eleventyConfig.addTransform("callout-block", function (str) {
|
eleventyConfig.addTransform("callout-block", function (str) {
|
||||||
const parsed = parse(str);
|
const parsed = parse(str);
|
||||||
|
|
||||||
@ -290,11 +292,11 @@ module.exports = function (eleventyConfig) {
|
|||||||
return JSON.stringify(variable) || '""';
|
return JSON.stringify(variable) || '""';
|
||||||
});
|
});
|
||||||
|
|
||||||
eleventyConfig.addFilter('validJson', function (variable) {
|
eleventyConfig.addFilter("validJson", function (variable) {
|
||||||
if(Array.isArray((variable))){
|
if (Array.isArray(variable)) {
|
||||||
return variable.map(x=>x.replaceAll("\\", "\\\\")).join(",");
|
return variable.map((x) => x.replaceAll("\\", "\\\\")).join(",");
|
||||||
}else if(typeof(variable) === 'string'){
|
} else if (typeof variable === "string") {
|
||||||
return variable.replaceAll("\\", "\\\\");
|
return variable.replaceAll("\\", "\\\\");
|
||||||
}
|
}
|
||||||
return variable;
|
return variable;
|
||||||
});
|
});
|
||||||
|
@ -22,24 +22,24 @@ permalink: "notes/{{ page.fileSlug | slugify }}/"
|
|||||||
|
|
||||||
<main class="content cm-s-obsidian">
|
<main class="content cm-s-obsidian">
|
||||||
<header>
|
<header>
|
||||||
{% if settings.dgShowInlineTitle === true %}
|
{% if settings.dgShowInlineTitle === true %}
|
||||||
<h1>{% if title %}{{ title }}{% else %}{{ page.fileSlug }}{% endif %}</h1>
|
<h1>{% if title %}{{ title }}{% else %}{{ page.fileSlug }}{% endif %}</h1>
|
||||||
{% endif %}
|
|
||||||
<div class="header-meta">
|
|
||||||
{% if settings.dgShowTags === true and tags %}
|
|
||||||
<div class="header-tags">
|
|
||||||
{% for tag in tags %}
|
|
||||||
{% if tag != 'gardenEntry' and tag !='note' %}
|
|
||||||
<a class="tag" onclick="toggleTagSearch(this)">
|
|
||||||
#{{tag}}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
<div class="header-meta">
|
||||||
|
{% if settings.dgShowTags === true and tags %}
|
||||||
|
<div class="header-tags">
|
||||||
|
{% for tag in tags %}
|
||||||
|
{% if tag != 'gardenEntry' and tag !='note' %}
|
||||||
|
<a class="tag" onclick="toggleTagSearch(this)">
|
||||||
|
#{{tag}}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
{{ content | link | taggify | highlight | safe}}
|
{{ content | hideDataview | link | taggify | highlight | safe}}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
{% if settings.dgShowBacklinks === true or settings.dgShowLocalGraph === true or settings.dgShowToc === true%}
|
{% if settings.dgShowBacklinks === true or settings.dgShowLocalGraph === true or settings.dgShowToc === true%}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
{%- for garden in collections.gardenEntry -%}
|
{%- for garden in collections.gardenEntry -%}
|
||||||
{{garden.templateContent | link | taggify | highlight | safe }}
|
{{garden.templateContent | hideDataview | link | taggify | highlight | safe }}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user