Nick Sloan wrote: ↑2021-12-29 14:26:15
Hi Martin, it seems that your macro is leaving spaces between the leading asterisk/underscore and the words converted into italic and bold which defeats the MD styling.
I'm not sure I know what you mean. That doesn't seem to be happening on my Mac. Here's my test selection:
markdown-before.png (39.78 KiB) Viewed 4892 times
And the resulting markdown text:
markdown-after.png (68.69 KiB) Viewed 4892 times
That looks correct to me, with no unwanted spaces. What are you seeing?
Also, is there any reason why I could not substitute single asterisks for underscores for the italic styling?
I don't see why not. You can edit the macro's replacement expressions however you like.
Thanks again martin. My mistake, or possibly a limitation of the conversion: I had inadvertently italicised the leading spaces before the italic and bold words, so the underscore/asterisks preceded the spaces and not the words, which was enough to defeat the MD display. Now I understand this I can be more careful in how I apply styles, though it would be nice if the conversion were more tolerant of the style of spaces.
Another thing I am finding is that irrespective of the font or font face present in the original text (even if it is all regular), the conversion leaves everything in italic bold in my Nisus file. This doesn't matter to me since I am forwarding it as MD, just curious. Doesn't seem to be the case with your sample.
As a matter of interest, I have found that not all Markdown apps are created equal: they vary widely in how they receive pasted RTF. Some will receive it as plain text whereas others will attempt to convert italic and bold into styled MD. I have found that Paper does the best job of doing exactly the sort of conversion that I was using this macro for. This does not make the macro redundant, since I'm sure it does a lot more with headings and tables etc than Paper can handle, but for simple conversions it may be all you need.