scottashipp / noted

Lightweight CLI for taking markdown notes in a journal-like (time-seried) fashion
GNU General Public License v3.0
86 stars 26 forks source link

Plz remove the leading newline when creating new note #8

Closed Xiangze-Li closed 2 years ago

Xiangze-Li commented 2 years ago

I noticed every time new notes are created, a leading and a tailing newline will be added to the template. If the template has YAML front matter, the leading newline may cause error parsing the YAML. Please consider remove the leading newline

scottashipp commented 2 years ago

Hi @Xiangze-Li ! I'm not too familiar with this use case. Can you explain further? Why would markdown files have YAML front matter? noted explicitly supports Markdown only right now, like the About mentions:

Lightweight CLI for taking markdown notes . . .

But if there is a use case where not having the new lines added in is better for some users, we can probably incorporate this in the next release into a config option?

Xiangze-Li commented 2 years ago

Thanks for replying! I read a blog about use noted to take notes then use hugo or other tools to generate a website from all the md files. With YAML front matter, I can add some metadata to the pages, like:

---
author: XXX
date: TIMESTAMP
---

# HEADERTEXT

If there's no leading newline, everything will work just fine.

Thanks again!

scottashipp commented 2 years ago

@Xiangze-Li Hi! Sorry for the delay here. We had a holiday on Monday in the US so I was gone over the weekend.

OK so it sounds like you just need to configure a custom template file for your use case. This is already supported by noted! :tada:

Please refer to the section on custom configuration where you will set up a .notedconfig file with a NOTED_TEMPLATE_FILE property. The value of this property should be the path to your own template file. It explains it all in the link.

Let me know if you have any questions or any issues with it.

Xiangze-Li commented 2 years ago

Hi! I tried the custom template config again, it worked this time. I must have made some mistakes last time I edit the template.

Sorry for these trouble. Many thanks for your assistance! And wish you a happy holiday!