To Markdown macro

Get help using and writing Nisus Writer Pro macros.
User avatar
martin
Official Nisus Person
Posts: 5113
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: To Markdown macro

Post by martin »

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
markdown-before.png (39.78 KiB) Viewed 2085 times

And the resulting markdown text:

markdown-after.png
markdown-after.png (68.69 KiB) Viewed 2085 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.
Nick Sloan
Posts: 22
Joined: 2004-08-01 02:35:18

Re: To Markdown macro

Post by Nick Sloan »

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.
Nick Sloan
Posts: 22
Joined: 2004-08-01 02:35:18

Re: To Markdown macro

Post by Nick Sloan »

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.
Post Reply