Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for Front Matter by default? (for first-class metadata such as titles and tags) #296

Open
realshovanshah opened this issue Jan 18, 2024 · 2 comments

Comments

@realshovanshah
Copy link

Hey,

While the project supports front matter for "user defined metadata", it does state support for setting this as the default. That is, if I were to create a note, the markdown file should use front matter by default for metadata.

Hope this is a natural request with respect to the course nb's trajectory. Let me know if I'm missing anything.

@xwmx
Copy link
Owner

xwmx commented Feb 11, 2024

@realshovanshah It seems like this might be possible to implement alongside templates as requested in #22.

The only front matter metadata used by nb itself is the title: field, which is used for filtering, listing, and selecting items. Other types of metadata used by nb, such as timestamps and authors, are derived from existing metadata in Git or the filesystem. Most of the common fields in front matter like permalink:, layout:, or published: [1] [2] [3] are independent of nb functionality. author: / authors: and date: fields overlap with nb show --authors, nb show --added, and nb show --updated, but the data is different in format and nature, so any related front matter features would probably be best implemented with dedicated command line options rather than overriding the existing values.

Tags are another area of overlap. It's a little bit complicated since there are a couple ways to format tags in front matter, and then deciding how to perform CRUD operations on the tag fields and sync with tags in text or not would need to be worked out and implemented.

There are ways this could be theoretically approached in stages, such as first reading front matter tags just for the nb search --tags functionality, or for defining initial front matter fields via a template.

It's also conceivable that front matter functionality could be implemented as a plugin that defines a dedicated subcommand for managing and reading front matter.

@PresGas
Copy link

PresGas commented Feb 16, 2024

I was just thinking about this. So glad we are talking about it. Could it just be an additional function implementing expanded front matter/templating and then built into an argument under nb add?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants