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.

Sections as fields?

See original GitHub issue

Any chance of having support for using markdown sections (i.e. content under a header) being used as fields (with multiline values and markdown rendering)?

This is different from #23, in that the question here is one of using the content of a section (including nested sections) as fields rather than treating the items themselves as records (as in #23). (Likewise, it’d actually be nice to be able to use standardized block names as fields; e.g. to pull out the ^thesis block of a file and treat it as a field for that file’s row, to get a nice grid of chapter thesis statements.)

Anyway, I ask because I’ve recently found myself wanting to display the contents of various note files (structural work on chapters for a book) in consolidated form. For example, to display all the intros or all the exercises, and be able to see which parts of what chapters are fleshed out or not.

(Even more awesome would be if you could edit in place or at least have a way to click and open the relevant note+section.)

Anyway, I’ve been sort of kludging a solution using hovering over various links, and using section titles that are links to chapter titles and whatnot, and been wishing I had a better way. I was thinking of maybe implementing some sort of query layer over the markdown, and then I stumbled across a reference to this plugin. 😉

(Anyway, I totally understand if this is something completely out of scope. Just thought I’d ask.)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
zachdanielcommented, Oct 31, 2021

For anyone else that ends up here, I used the recommendation above to build a dataviewjs block that brings in the list of quotes of my files tagged w/ people (which use a template that adds a quotes section using the comment delimiters I refer to in the snippet:

let quotesPromises = dv.pages("#people").map(async (p) => {
  const link = p.file.link;
  return await dv.io.load(p.file.link).then((contents) => {
    const indexOfQuotes = contents.indexOf("<!-- quotes -->");
    if (indexOfQuotes > 0) {
	  const quoteStart = contents
	    .substr(indexOfQuotes + 16)
		
	  const quotes = quoteStart.substr(0, quoteStart.indexOf("<!-- end quotes -->")).trim();
	  
	  if (quotes === "") {
	    return [];
	  } else {
	    return quotes.split(">").map(q => q.trim()).filter((q) => q !== "").map((quote) => [p.file.link, quote]);
	  }
	} else {
	  return []
	}
  });
});

let quotes = (await Promise.all(quotesPromises)).flat().filter((q) => q.length > 0);

dv.table(["Author", "Quote"], quotes);

Which yields something like this: CleanShot 2021-10-31 at 01 54 11

2reactions
blacksmithgucommented, Mar 6, 2021

Interesting idea. I am planning on adding a “embed query”, where you can query for sections / blocks / whatnot and they will render similarly to if you had done a bunch of manual ![[]] embed statements, which will get part of what you want.

Editing in place sounds cool, though would be difficult (dataview generally works where you write the query in edit mode, and view the result dynamically in preview mode). It might be possible via a custom view (i.e., a “query” view where you type in a query at the top and you can view results at the bottom), though that would be further in the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fields section | Kirby CMS
With the fields section you can create flexible forms for your pages. Add all fields in a single fields section or combine multiple...
Read more >
Fields & Sections - Accentuate Custom Fields
Fields & Sections · Fields are the essence of ACF. · You can use fields to store information, medias, references, etc. · Before...
Read more >
Form sections and fields | Beacon Guide
Fields allow users to enter answers to the questions you've posed, and are collected together in groups called Sections such as 'Contact preferences'...
Read more >
How do I nest a field in a section? - Fulcrum Help Center
App elements (sections/fields) can be nested inside of other sections in order to allow you to group elements together in logical groups.
Read more >
Add Fields and Sections - FormAssembly Resource Center
Overview of Section Types ... Sections are containers that contain questions, or other sections. Sections provide a way to organize your form and...
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