Trying to build an extension

I am trying to create an extension where on the right side of the “Excerpt/Annotate” button it includes a new tab called “custom”, so it would include pencils with my mainly used RTF for the notes, for exemple I use highlight my notes into 3 ways:

1 - Bold and Italic for the sentences I should read fast when reviewing for understanding (priority 2);
2 - Bold, Italic and yellow highlight for the words/sentences/concepts that I should remember (priority 1);
3 - Emphasize words/numbers that I want to hide when reviewing on the reviewing mode.

I wish I could just create a pencil that when im reading the document I could just drag it through the words and it becomes marked just like the “emphasize mode” does when drawing the “text selection” along the words.
When I started using the app I found the “emphasize mode” as the fastest way to highlight words into an excerpt without breaking my thoughts. But now im struggling to use the “Review mode” since much more than what would be satisfactory is hidden. So after being able to decode how the RTF is applied I was trying to automate a conversion from emphasize to Bold&Italic into the words.

so to achieve that I found myself with some difficulties:

1 - I was unable to debug the extensions already existent, I was trying to use safari web inspect but it didn’t recognize the app both in iPad/Iphone or my Mac.
→ I tried both the Mac version of the app into the official website and the one in google drive (Add-on Developing & Testing Internal Discussion Thread @ExtsTester) in the hope the google drive one was in developer profile.

2 - As I couldn’t figure it out how to debug I tried by try and error to get the note data from the AutoTitle and Deepl already existent, but I couldn’t interpret how the RTF is applied to the data so I could save and used again.
Always when I load a note: var note = Database.sharedInstance().getNoteById(noteid);
and used note.excerptText or note.text I got plain text so I could figure out how to get the RTF format to change into the words.

To at least achieve my “emphasize to Bold&Italic” conversion I tried a different approach opening the sqlite DB but into the table ZBOOKNOTE i just found plain text again, no RTF format, just “**” representing the emphasize words.

Another detail I found was that every time I use “bold” into a note excerpt from the document it automatically turns into emphasize, so I couldn’t just make them bold. I can only bold/italic a word into a comment created.

Resuming: I wish I could just bold/italic/highlight some words into a faster way than opening one by one.

If anyone have similar difficulties or different approaches it would be of great help

Thank you for all, the app is amazing!

2 Likes

@sgarbi.rodrigo This is a late reply to your message, which I only just saw today.

Maybe you already figured this out (and in any case it’s really up to the MarginNote team to answer this), but I believe the RTF formatting is stored as an Apple binary property list (bplist00) in the ZNOTES column of the ZBOOKNOTE table. Once you fetch the raw data, you’ll need some library functions to decode/encode it.

HTH