-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
FOAM_SLUG template variable addition #865
FOAM_SLUG template variable addition #865
Conversation
I wanted to clarify something. Is it improper to use FOAM_TITLE in the file path? That, plus other recent fixes to slugs finally allowed for wikilinks to work well. I appreciate having the wikilink text having the capitalization and spaces. I have a lot of notes that use this format and would like to know if that’s becoming an unsupported pattern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution @techCarpenter! I have left a few comments for you, let me know your thoughts
@riccardoferretti Thank you for the notes, I'll address them! |
@chrisUsick I was told by @riccardoferretti that using FOAM_TITLE is the default way to do wikilinks in Foam. I suspect there could be issues when publishing files that have spaces in the filename. |
Ah, I see that in the comments. Thanks! |
The github slugger is not actually used, it seems to be a legacy part of Foam, I've opened a PR to remove the remnants (#872). Having a title is not required, but if your note has a title it's best to name the file after that title, or some transformation of it (but no transformation is enforced or preferred, therefore you have to do it manually, so again: better name your note after the title). Except that @riccardoferretti considers that some default transformation is desirable for templates. The problem I see with that is that one user may prefer |
The only constraints that Foam gives you is that wikilinks use the file name to find the resource.
This is not about templates, per my comment above, you can pick whatever path you desire. What would need a transformation might be the To summarize, sure you can have a |
What I meant is that when you create a template you have a title but not a slug, except when slug = title. But, sure, the same happens when you enter |
relevant comment: #872 (comment) |
Despite the outcome of the discussion ongoing in #872 I'd suggest to rename |
What do you mean by "slug is or may be used in other contexts"? |
More or less your open questions in #872 (comment). I mean, in this context it's clear that slug is something created from a title, but in other yet to be defined contexts that may not be the case. For example, in the ctrl-click over |
- Remove unused resolveFoamTitleSlug() function - Await resolveFoamTitle() in resolver promises - Rename `FOAM_TITLE_SLUG` to `FOAM_SLUG` - initialize `foamTitle` to `null`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes are up to date with comments by @riccardoferretti. New foam template variable FOAM_SLUG is available to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, thanks @techCarpenter!
PR merged into master branch |
@allcontributors add @techCarpenter for code |
I've put up a pull request to add @techCarpenter! 🎉 |
This is my first open source contribution. I'm excited to contribute and also eager to do things right so any feedback on this PR is appreciated!
This contribution addresses the discussion about slugifying wikilinks
The
FOAM_TITLE_SLUG
variable will be available in foam templates. When the note title is entered withCreate New Note
, a slug is created bygithub-slugger
that can then be used as part of the file name.Example:
FOAM_TITLE
FOAM_TITLE_SLUG