mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-05 12:25:20 +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) {
|
||||
return (
|
||||
str &&
|
||||
str.replace(
|
||||
tagRegex,
|
||||
function (match, precede, tag) {
|
||||
return `${precede}<a class="tag" onclick="toggleTagSearch(this)">${tag}</a>`;
|
||||
}
|
||||
)
|
||||
str.replace(tagRegex, function (match, precede, tag) {
|
||||
return `${precede}<a class="tag" onclick="toggleTagSearch(this)">${tag}</a>`;
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter("searchableTags", function (str) {
|
||||
let tags;
|
||||
let match =
|
||||
str &&
|
||||
str.match(
|
||||
tagRegex,
|
||||
);
|
||||
let match = str && str.match(tagRegex);
|
||||
if (match) {
|
||||
tags = match
|
||||
.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) {
|
||||
const parsed = parse(str);
|
||||
|
||||
@ -290,11 +292,11 @@ module.exports = function (eleventyConfig) {
|
||||
return JSON.stringify(variable) || '""';
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter('validJson', function (variable) {
|
||||
if(Array.isArray((variable))){
|
||||
return variable.map(x=>x.replaceAll("\\", "\\\\")).join(",");
|
||||
}else if(typeof(variable) === 'string'){
|
||||
return variable.replaceAll("\\", "\\\\");
|
||||
eleventyConfig.addFilter("validJson", function (variable) {
|
||||
if (Array.isArray(variable)) {
|
||||
return variable.map((x) => x.replaceAll("\\", "\\\\")).join(",");
|
||||
} else if (typeof variable === "string") {
|
||||
return variable.replaceAll("\\", "\\\\");
|
||||
}
|
||||
return variable;
|
||||
});
|
||||
|
@ -22,24 +22,24 @@ permalink: "notes/{{ page.fileSlug | slugify }}/"
|
||||
|
||||
<main class="content cm-s-obsidian">
|
||||
<header>
|
||||
{% if settings.dgShowInlineTitle === true %}
|
||||
<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>
|
||||
{% if settings.dgShowInlineTitle === true %}
|
||||
<h1>{% if title %}{{ title }}{% else %}{{ page.fileSlug }}{% endif %}</h1>
|
||||
{% 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>
|
||||
{{ content | link | taggify | highlight | safe}}
|
||||
{{ content | hideDataview | link | taggify | highlight | safe}}
|
||||
</main>
|
||||
|
||||
{% if settings.dgShowBacklinks === true or settings.dgShowLocalGraph === true or settings.dgShowToc === true%}
|
||||
|
@ -35,7 +35,7 @@
|
||||
</div>
|
||||
</header>
|
||||
{%- for garden in collections.gardenEntry -%}
|
||||
{{garden.templateContent | link | taggify | highlight | safe }}
|
||||
{{garden.templateContent | hideDataview | link | taggify | highlight | safe }}
|
||||
{%- endfor -%}
|
||||
</main>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user