Skip to content

Instantly share code, notes, and snippets.

@deqline
Last active September 21, 2022 14:04
Show Gist options
  • Save deqline/44d23b60228fd50003e54eb66d26b6ee to your computer and use it in GitHub Desktop.
Save deqline/44d23b60228fd50003e54eb66d26b6ee to your computer and use it in GitHub Desktop.
Remove ID'S text in Obsidian_to_Anki plugin folder in your vault workspace -> replace functions in main.js in installed plugins folder
function id_to_str(identifier, inline = false, comment = false) {
let result = "ID: " + identifier.toString();
if (comment) {
result = "<!--" + result + "-->";
}
if (inline) {
result += " ";
}
else {
result += "\n";
}
return "";
}
writeIDs() {
let normal_inserts = [];
this.id_indexes.forEach((id_position, index) => {
const identifier = this.note_ids[index];
if (identifier) {
normal_inserts.push([id_position, id_to_str(identifier, false, this.data.comment)]);
}
});
let inline_inserts = [];
this.inline_id_indexes.forEach((id_position, index) => {
const identifier = this.note_ids[index + this.notes_to_add.length]; //Since regular then inline
if (identifier) {
inline_inserts.push([id_position, id_to_str(identifier, true, this.data.comment)]);
}
});
let regex_inserts = [];
this.regex_id_indexes.forEach((id_position, index) => {
const identifier = this.note_ids[index + this.notes_to_add.length + this.inline_notes_to_add.length]; // Since regular then inline then regex
if (identifier) {
regex_inserts.push([id_position, id_to_str(identifier, false, this.data.comment)]); //REMOVED NEW LINE BEFORE ID STRING
}
});
this.file = string_insert(this.file, normal_inserts.concat(inline_inserts).concat(regex_inserts));
this.fix_newline_ids();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment