Might be of interest:
I had an obscure problem. I make journal entries in DayOne and enter todos as ‘- todo’ (i.e. hyphen then name of todo). DayOne formats these as blue dots. ie if I think of a todo, I add the hyphen/bullet into the text as I write and carry on with my entry.
I then cut and paste the journal entry to Drafts and delete all the extraneous text, and edit so I can run the Things parser. The paste operation means the custom DayOne markdown blue dot bullet is replaced with a ‘•’. The Things parser script in Drafts expects a ‘-‘. DayOne tech support says modifying their custom markdown is not possible.
I realize in Drafts, I could find/replace all ‘•’ with ‘-‘.
Out of curiosity, I prompted ChatGPTL https://chat.openai.com/chat:
“Create Drafts script to convert DayOne custom markdown bullet to standard markdown bullet.”
It produced the following result (with an explanation):
function convertBullets(line) {
return line.replace(/.\s/, '- ');
}
let lines = draft.content.split('\n');
let output = [];
for (let line of lines) {
output.push(convertBullets(line));
}
draft.content = output.join('\n');
It took me a couple of tries to fix the script by replacing the period ‘.’ with ‘•’: ie replace
return line.replace(/.\s/, '- ‘);
with
return line.replace(/•\s/, '- ');
I’d never tried scripting in Drafts before. ChatGPT gave me a very useful start!