-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add a macro for importing settings from external files #77
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR! I'll try to take a look soon. |
Great solution, but I don't know how to edit content of settings.tex. Can you give me an example? Thanks a lot. |
@a76854 It's basically a list of |
Dear @mozhewen , After creating an issue about this topic i jsut stumbled across this thread, sorry if I mistaking something here. |
@cdpotti Yes, you can use different tikz libraries documented in tikz's manual. However, I also tried some tex packages like |
async embedTexInput(tikzSource: string): Promise<string> { | ||
return this.replaceAsync(tikzSource, /^%:input\s+(.+)$/gm, async (_, path) => { | ||
const file = this.app.vault.getAbstractFileByPath(path); | ||
if (file instanceof TFile) { |
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.
Should we print a warning to the console if a user inputs a filepath that Obsidian can't locate?
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.
Yep, that would be helpful.
Hello, apologies for the delay - it looks good to me! Can you add some documentation on this feature to the README.md? |
A solution to #76
After thinking about it a few days, I realized that reusing settings from former code blocks may lead to uncontrollable behavior because when those blocks are changed, some update events should be triggered for other blocks, which complicate the problem.
On the other hand, I found importing external files is easier to implement. Now we can write a
%:input
macroto import settings from files. The result now looks like
It's not a perfect solution for the moment. The blocks do not respond automatically to the settings file change. But, as the
settings are not changed frequently, and one can always reopen the .md file to refresh all pictures, it's acceptable for me.
Hope someone comes up with a better idea.