Open Vemahk opened 5 months ago
I do believe this would also solve the same problem the fellows in #29 where asking for. At least in part.
A couple things:
this.addCommand({
id: "smart-typography-apply-quotations-vault",
name: "Apply Smart Quotes to Entire Vault",
callback: () => {
for (const file of this.app.vault.getMarkdownFiles()) {
const view = this.app.vault.read(file)
if (view) {
view.then((text) => {
return smartquotes.string(text);
}).then((text) => {
this.app.vault.modify(file, text);
});
}
}
}
});
That seemed to work for my naive use case. If not comfortable with using another library, can run through it line-by-line through your algo in apply-quotes.ts too.
Honestly it didn't occur to me that someone else may have written some js module for applying these quotations. Oh well.
I didn't add a full-vault command since I didn't need it. I guess you're welcome to open your own PR for that, but I doubt this one will ever get merged as it is, and I'm allergic to scope creep, so... shrug
Howdy.
I've been using Obsidian for writing (not just note taking) for a little while before I stumbled upon this plugin. I wanted to go back and fix all my existing quotations to use the "correct" form. At first, I just got really good with the vim motions of replacing them all, but for some of my multi-ten-thousand word docs, that just wasn't viable. So I tinkered and came up with this.
I mainly did this for my own personal use, so I admit I haven't quite got all the kinks of how to retroactively apply topography to the single quotes (since it's difficult to distinguish apostrophes from single quotations for certain scenarios), but I thought I'd leave this here just in case someone else found it useful. Feel free to modify, critique, merge, or completely ignore this.