question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Link to header created by dataviewjs

See original GitHub issue

Where is any way to create link to header that was created in dataviewjs? Something like this:

file1.md:

[[file1.md#header]] <- Unable to find section #header in file1.md

 ``` dataviewjs
dv.header(1,'header')
```

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alexey-zaharchenkocommented, Jul 30, 2022

Yes and no 😃 I create page with info of every frontmatter key of every page in vault and that page have TOC created via dataviewjs.

Maybe code will be more clear:

const fmts = [];
const rows = dv.pages().forEach(note => {
                  for (const k in note.file.frontmatter) {
                      if (!fmts[k]) {fmts[k] = []}
                      fmts[k].push(note.file.link)
                  }
              })

dv.table(['key name', 'count', 'examples'], Object.keys(fmts).map(k => [
    k // section link doesn't work here yet dv.sectionLink(dv.current().file.path,k,false,k)
    , fmts[k].length
    , fmts[k].slice(0, 3)
]));

dv.el('hr', '')

Object.keys(fmts).forEach(k => {
    dv.header(2, k);
    dv.list(fmts[k]);
})
0reactions
blacksmithgucommented, Aug 28, 2022

Dataview headers are not “real” headers and can’t be linked to (since they directly render to your view, and are not Markdown).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get started with Obsidian Dataview and DataviewJS
dv.header(2, 'Website'); // print 'Website' as an H2 dv.paragraph(pg.website) // print website url from YAML in a paragraph
Read more >
Codeblock Reference - Dataview - GitHub Pages
Dataview JavaScript Codeblocks are created using the dataviewjs language specification for a ... Render a header of level 1 - 6 with the...
Read more >
DataviewJS Snippet Showcase - Obsidian Forum
This is the dataviewjs code block only. You'll have to type your own header. :wink: // Nearby Family Members, Friends and Places //...
Read more >
Using DataviewJS to dynamically create multiple tables
In this article, I will discuss how to use DataviewJS to create multiple headings and tables in a row from a single Dataview...
Read more >
Display all Headings from a file with Dataview or DataviewJS
The documentation cites a setting you can set to get the plugin to try to display things correctly if you have inconsistent heading...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found