We switched to a manual approval system for registration on this forum, as this makes it easier to keep bots out of the forum. We'll approve everybody who doesn't look like a bot!

Setting document titles, YAML Frontmatter, and git hooks

Hi folks!

Firstly, thanks for creating Zettlr; I'm new to both Zettlr and Zettelkasten, and not sure if it'll be for me long-term, but am excited to give it a shot!

Looking at screenshots on https://docs.zettlr.com/en/guides/guide-zettelkasten/ and https://zettlr.com/#, I can see that on the Sidebar the documents are shown with headings, rather than their IDs (with the modified date, ID, and number of tags on the line below).

  1. What is valid syntax for defining a document title such that it appears in the sidebar? Is there any documentation you can point me to about this, or the layout of the sidebar in general? I couldn't find anything as comprehensive as I'd hoped.

    Apparently using YAML Frontmatter works, but I wonder if there are alternatives? For example I tried to use a Markdown heading, but that didn't show up in the sidebar.

  2. Related: Is there any documentation abour what YAML Frontmatter is supported by Zettlr?

  3. Is there (or will there be) an ability to have Zettlr automatically commit to git when a file is saved? I've created a git repo in my Zettlr directory, but ideally I'd like to not forget to commit changes, so an auto-commit would be handy.

Comments

  • Bonjour!

    1. Valid syntax is, for now, only YAML titles (see snippet below) — Zettlr will either take the filename sans extension, or, if a YAML frontmatter title is given, that. Nothing else will work, which is partially a conscious decision.
    2. I'm actually not sure, but what's supported so far are the title and keywords-properties. If it's not in the docs, feel free to contribute and add the documentation on that!
    3. No, and probably never will be. Zettlr will always require you to make conscious choices about what is happening. There are some vague ideas for git support, but even that would at least require you to press a button for committing. But that's science-fiction for now, because it requires a lot of work to make that happen nicely!
  • Thanks for your response @hendrik! That clears things up nicely. :)
    I'll see what I can do about documenting (2). I'm actually not really familiar with YAML frontmatter, and only worked out how to do this via the screenshot on the Zettlr homepage, and doing a web search for 'yaml frontmatter' only yields a bunch of other projects that support it, as opposed to any canonical, standardised, or authoritative documentation; it seems to be entirely built on convention!

    Nonetheless, I'll try to do some digging and possibly make some updates!

  • In Pandoc it's called "YAML metadata block", in this section: https://pandoc.org/MANUAL.html#metadata-blocks

    The first kind of metadata blocks is not supported, but just scroll down a little bit to see everything you need to know about YAML frontmatters (or, as I said, metadata blocks)!

    The internet kind of settled with "YAML frontmatter", so no wonder the Pandoc documentation doesn't yield something :D

  • Hah, yeah, that'd be right! Consistency? What's that? :tongue:

  • I'm following as I can't get my head around how YAML works with Zettlr, so please let us all know if you get anywhere with documenting this :smile:

  • @jadcx said:
    I'm following as I can't get my head around how YAML works with Zettlr, so please let us all know if you get anywhere with documenting this :smile:

    Basically Zettlr doesn't touch YAML frontmatters, so they work exactly as described in the Pandoc documentation, and there's nothing more to it. Only two things: 1) keywords will be parsed by Zettlr and added to the list of tags, 2) title will be used instead of the filename in various displays, if there is one

  • Thanks @hendrik - that's pretty much what I thought, but I have not been able to implement using the title from a YAML header, it doesn't seem to be included in the search, and isn't appended to internal links.

  • Are you sure? I've had no problems linking w/ the frontmatter title in the form of [[12345]] The title from the frontmatter. Which version are you using?

  • @hendrik said:
    Are you sure? I've had no problems linking w/ the frontmatter title in the form of [[12345]] The title from the frontmatter. Which version are you using?

    Currently, I'm on 1.7.0-beta.11 but I couldn't get it to work before trying the beta. I haven't logged this anywhere as I'm 100% not confident that I'm not doing something blindingly stupid.

  • Currently, I'm on 1.7.0-beta.11 but I couldn't get it to work before trying the beta.

    Maybe have a look at the most recent version of the changelog, I'm confident this behaviour was implemented later, and as 1.6 is already almost four months old, this would explain that :D

  • @hendrik said:

    Currently, I'm on 1.7.0-beta.11 but I couldn't get it to work before trying the beta.

    Maybe have a look at the most recent version of the changelog, I'm confident this behaviour was implemented later, and as 1.6 is already almost four months old, this would explain that :D

    Yes, totally that! Working entirely as expected in 1.7.0-beta.13.

  • Tadaaa 🎉

Sign In or Register to comment.