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 Markdown Tasks",
description: "Removes Markdown task list items and one blank line after each.",
availableKinds: ["Scene"],
options: [],
},
compile(input, context) {
return input.map(scene => {
const lines = scene.contents.split("\n");
const resultLines = [];
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
// Check for a Markdown task item
if (/^\s*[-*]\s+\[[ xX]\]/.test(line)) {
// Skip this task line
// Also check if the next line exists and is blank — skip that too
const nextLine = lines[i + 1];
if (nextLine !== undefined && /^\s*$/.test(nextLine)) {
i++; // skip the blank line too
}
continue;
}
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-tasks.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'd like a step that removes all checkbox paragraphs/tasks, checked or unchecked
Should this step affect scenes, manuscripts, or join the two?
scenes/manuscripts
The text was updated successfully, but these errors were encountered: