Skip to content

Instantly share code, notes, and snippets.

@emisjerry
Created October 22, 2021 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emisjerry/9dcd3dfd9a337530731f22253d43e6b7 to your computer and use it in GitHub Desktop.
Save emisjerry/9dcd3dfd9a337530731f22253d43e6b7 to your computer and use it in GitHub Desktop.
Obsidian QuickAdd macro for replacing YAML tags
module.exports = async function get_tags(params) {
const {app, quickAddApi: {suggester}} = params;
const activeLeaf = app.workspace.activeLeaf;
const editor = activeLeaf.view.editor;
const lineNumber = editor.getCursor().line;
const position = editor.getCursor().ch;
let content = editor.getLine(lineNumber);
content = content.replace(/#/g, "");
editor.setLine(lineNumber, content);
editor.setCursor(lineNumber, position);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment