Scripting Rich Text to Plain Text

I’m beginning to enter the world of omniJS. Does anyone know if it’s possible to change rich text to plain text (or vice-versa) with omniJS? I don’t mind using a rich text interface while I’m working and then later run a script to change formatted text to a Markdown syntax.

For example, I’m interested in scripting all bold to **bold** and all italics to *italics* throughout my OO document.

That should be possible by getting all of the objects with each text style you need to change to markup, then using string.replace to change the content. I’d start by combining the examples at https://omni-automation.com/omnioutliner/style.html to get the text objects with that styling, and string.replace method mentioned at https://omni-automation.com/omnioutliner/text.html. The final step is to export as in the example at https://omni-automation.com/omnioutliner/document-export.html.

Best of luck with your scripting!

1 Like