Closed jonathanhung closed 1 year ago
Could be related to #254
This should have been fixed in the latest release. Please let me know if updating to the latest version fixes it for you
updated to 2.51.0 but still not getting desired behavior.
Here are the three queries
Here's the render in the digital garden:
They are rendering (both in Obsidian and Digital Garden), but I don't think eleventy or markdownit is converting the links that come from dataviewJS.
You can see in this final image that a class name block-language-dataview
is added to the <ul>
when using DV, but when using DVJS it gets just dataview
I'm guessing there's a missing slugify
arg somewhere in markdownit or eleventy. Or the logic doesn't have the right conditional to locate ul.dataview
ahh, it looks like Eleventy wants to find children of .cm-s-obsidian
- I got rid of that class in the template to gain control of the CSS cascade. let me see what happens
Edit: added back that classname and it still isn't converting those links to slugified links
Looking at the markdown file itself it looks like eleventy or markdownit / slugify just ignores the HTML and converts the markdown link.
Co-Pilot wants me to include a filter in the nunjucks template to slugify the URLs. I went into eleventyJS and after some back and forth with Co-Pilot, I added a clause to the eleventyJS link
filter that finds .md links and slugifies them, and this solves it.
.replace(/href="([^"]+)"/g, function (match, p1) {
if (p1.endsWith(".md")) {
const urlPath = p1.replace(/\.md$/, "");
const slugifiedUrlPath = urlPath
.split("/")
.map((part) => slugify(part))
.join("/");
return `href="/${slugifiedUrlPath}/"`;
} else {
return match;
}})
Also worth sharing that when you use dataviewJS function dv.markdownList it still outputs markup not markdown.
Presently trying to amend the link
filter in eleventyconfig to find those urls and slugify them. or to create a new filter
Yep, you are right @jonathanhung, the links from dataviewJs is not working. It's due to the plugin not handling rewriting html links, it only handles markdown links. I'm currently tracking this issue on #346
This has now been fixed in the latest version of the template. Updating the template should result in all dataviewjs links behave similar to other links.
Using this code in obsidian:
The div.innerHTML returned by convertDataView is an empty list (seen in obsidian console)
Expected (seen in Obsidian)
Conclusion: using file.link works in obsidian but not with digital garden?