Replies: 1 comment
-
Are you creating a plugin to support metadata on top of the .md file? I would need this to open folder created by Obsidian. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
i'm currently extending TW to support YAML-Frontmattered File-Formats (i'm on node). The implementation itself is clear to me. What i'm struggling about is, how would i integrate it best into TW itself? I tried the following ways without my intented success:
What works as expected is, when i change the file boot.js (what obviously is no good idea) by defining my own module like this:
Is there a way to solve that in a more plugin'ish way?
==== SECOND TOPIC ====
The way back to the fs is implemented in sort-of more plugin'ish way, but also not really satisfactory to me and my understanding of a good integration: i use a "module-type: utils-node" and remember the current "saveTiddlerToFile" function like this:
const origSaveTiddlerToFile = $tw.utils.saveTiddlerToFile;
then i overwrite the "saveTiddlerToFile"-Function in there like so:
exports.saveTiddlerToFile = function(tiddler,fileInfo,callback) { MY NEW CODE HERE};
Within this function i simply check, if the current tiddler is something i'm interested in (basically by looking at the type "text/-x-markdown") and do my stuff by directly working with nodes fs/path-modules. Otherwise i delegate to the "rembered" function by invoking origSaveTiddlerToFile .... Kinda hack'ish isn't it?
How would i solve that in a more TW/plugin'ish way?
Thanks a lot,
Mirko
Beta Was this translation helpful? Give feedback.
All reactions