Hello Coda Family
I’ve been trying to replace markdown imported in Coda as:
*text* or **text**
and then convert it to HTML for italic or bold only.
I worked my way around the italic:
"Why is business an infinite game? (4) " → “Why is business an infinite game?
However, I can’t wrap my head around replacing the bold and doing it without having an overlap of the bold and italic condition since they both contain the * character
Anyone can help a regex noob?
UPDATE: I found @Paul_Danyliuk 's regex video which was quite helpful, so now I only have to figure out the bold part. Here’s the link for those interested: Regular Expressions - YouTube
I might look a bit more into it, but I’m afraid the only way is to chain two patterns here:
.RegexReplace('\*\*([^*]+)\*\*','<b>$1</b>') // first passage to capture bold
.RegexReplace('\*([^*]+)\*','<i>$1</i>') // second for italic
Let me know if it works (havent tested yet…).
Hey Jay! I’d definitely give Federico’s suggestion a try, but I’d also like to hear more about your workflow. We convert text automatically through the API, so I’m wondering if you are copy/pasting the actual markdown code? If so, where are you copying from? We can pass this feedback along to our product team
Work’s perfectly, thank you!!!
I’m copying from Obsidian, this is how the “raw” markdown looks like:
I don’t think there’s any bug here, if I copy bold text from the internet it will usually be pasted as bold in Coda. My “importer” wouldn’t work if the content was automatically converted to markdown since I need the characters to be able to replace them
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.