corpus icon indicating copy to clipboard operation
corpus copied to clipboard

Automatic title in front matter should be title cased and replacements should be done for - and _

Open DavidGamba opened this issue 5 years ago • 1 comments

I normally don't use any spaces in my file names. Always use - or _ to separate words.

When I run :Corpus new-note.md I would expect the front matter to be:

---
title: New Note
---

Thanks for an awesome plugin!

DavidGamba avatar Sep 30 '20 22:09 DavidGamba

Have you looked at the docs for the transform setting?

https://github.com/wincent/corpus/blob/2b1db226a00d8dd0a7c1aee4fd30ffa01ab572e3/doc/corpus.txt#L200-L220

This tells Corpus how titles and filenames map onto each other. At the moment there are two modes:

  • local: title equals filename, but without ".md" extension — so this means if you want spaces in your title, you'll need them in your filename too.
  • web: filenames have underscores instead of spaces, and links will have a prefix prepended to them, if set (eg. /wiki/).

Those are the two I need (for my local notes and remote wiki), so I was thinking that a third one could be added which would just be fn and accept an arbitrary function; then you would be able to apply any transform that you want.

wincent avatar Oct 04 '20 21:10 wincent