Replace broken characters and make a list

Hi so I have text from a power point I make notes in MarginNote that come out like this:

Current Rate Method  Alternative names: Translation  Views the overseas operation as an investment  All assets and liabilities (i.e., net assets are exposed to exchange rate risk)  Exchange rate gains and losses are unrealized and stored in equity until the overseas operation is disposed of  CTA realized in income statement on disposal

Note the boxes come out as a question mark in drafts and other apps. How would I be able to crest a script that goes through and inserts a line break st that character and turns them into a bullet list. This is what I have so far from the action library.
let split = draft.content.split(“”);
draft.content = split.join("\n");

Thank you !

This seems to work for me using your example above.

draft.content = draft.content.replace(/  /g, "\n").replace(/^(.*)/gm, "- $1");

Here’s a version to download directly.

The first line does the heavy lifting. It takes the draft content and using the line separator string, replaces that string with new lines. It also prefixes each line with a hyphen followed by a space (a Markdown bullet). The second line forces an explicit update of the draft content.

Hope that helps.

1 Like