You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module.exports = {
description: {
name: "Remove Callouts",
description: "Removes all Obsidian callout blocks and one blank line after each.",
availableKinds: ["Scene"],
options: [],
},
compile(input, context) {
return input.map(scene => {
const lines = scene.contents.split("\n");
const resultLines = [];
let inCallout = false;
let skipNextBlank = false;
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
// Start of a callout block
if (/^>\s*\[!\w+.*?\]/.test(line)) {
inCallout = true;
continue; // skip this line
}
if (inCallout) {
if (/^>/.test(line)) {
continue; // still in callout, skip line
} else {
// Exiting callout block
inCallout = false;
// If this line is blank, skip it and continue to next
if (/^\s*$/.test(line)) {
continue; // skip this one blank line
}
}
}
// Not in callout, add line to result
resultLines.push(line);
}
return {
...scene,
contents: resultLines.join("\n"),
};
});
},
};
To add this custom step to your vault:
create a /steps folder inside your vault.
copy the above text into a text file and save it as remove-callouts.js
go into the settings for the longform plugin and select /steps as the location for User script step folder
What should this step do?
I would like a step that will remove all call-outs in the text.
Should this step affect scenes, manuscripts, or join the two?
scenes/manuscripts
The text was updated successfully, but these errors were encountered: