Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Template zettels #328

Closed
srid opened this issue Aug 7, 2020 · 6 comments
Closed

Template zettels #328

srid opened this issue Aug 7, 2020 · 6 comments
Labels
Cerveau enhancement New feature or request proposal Proposal with exact spec yet to be fleshed out

Comments

@srid
Copy link
Owner

srid commented Aug 7, 2020

I imagine we don't need a very flexible template system.

Initial proposal, to be refined:

  • Templates can be added to a subdirectory, eg: ./templates/daily.md (see Revision 2 below)
  • Template vars are simple strings wrapped in __ (see below)
  • Have neuron new --template=daily use the specified template

Here's a sample template, ./template/daily.md:

---
date: __DATE__
tags:
  - journal
---

# __TITLE__

## Agenda today

- 

## Achieved today

Today I achieved, ...

We may even go one step ahead and support arbitrary key value pairs (neuron new --template=daily --data="key1=123"), with __KEY1__ somewhere in the template body.

@srid srid added enhancement New feature or request proposal Proposal with exact spec yet to be fleshed out Cerveau labels Aug 7, 2020
@srid
Copy link
Owner Author

srid commented Aug 12, 2020

note to self: @TheMatten and I discussed some ideas on supporting general template functions (using the {{...}} syntax of #312 (comment)), and that needs to be spec'ed out one day.

@bangedorrunt
Copy link

i think we should add title in front matter. that would help much when doing grep search, current title using # might conflict with code where # is used for comment.

@srid
Copy link
Owner Author

srid commented Sep 3, 2020

@babygau title in front matter is already supported. # title is used only when you don't specify one in the front matter.

Neuron generates # title by default, however - because it is the natural choice when writing Markdown. The grep problem you mention should be resolved on its own (lexical grep?), rather than requiring front matter title (which should remain optional) simply because of grep's shortcomings.

Anyway what we are talking about is unrelated to this issue; it should be a discussion in a new issue.

@bangedorrunt
Copy link

tks u for response. i asked because i came from here (meta data) and it doesn't mention title. i also had an warning error complain about malformed data when i have title: metadata

@srid
Copy link
Owner Author

srid commented Sep 4, 2020

Guess we should document it then. As for the metadata error, try putting the title in double quotes (having to do this is yet another reason to prefer regular Markdown titles).

@srid srid pinned this issue Sep 6, 2020
@srid
Copy link
Owner Author

srid commented Sep 6, 2020

Revision 2

This proposal could further be simplied. No need for a hardcoded list files; just put the templates in neuron.dhall, which also allows us to support structured templates (and then do dhall2yaml for YAML frontmatter). Consider something like dhall-text if appropriate.

@srid srid unpinned this issue Sep 10, 2020
Repository owner locked and limited conversation to collaborators Aug 8, 2021
@srid srid closed this as completed Aug 8, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Cerveau enhancement New feature or request proposal Proposal with exact spec yet to be fleshed out
Projects
None yet
Development

No branches or pull requests

2 participants