mac_apt icon indicating copy to clipboard operation
mac_apt copied to clipboard

exported Notes lose formatting

Open bshannon opened this issue 6 years ago • 12 comments
trafficstars

Exported notes contain only the plain text content of the notes, losing any rich text formatting. The formatting information seems to be stored separately from the text that it applies to. It's not obviously in html or rtf or any other common rich text format. It would be great if this formatting information could be extracted and applied to the text, creating an html or markdown or similar rich text document. The Exporter app is able to create a markdown version of the text.

bshannon avatar Dec 12 '18 00:12 bshannon

On older versions of the notes app, the database contains html, which if available is provided by the notes plugin. However, newer versions have an unknown format where the data and formatting are stored separately. I have described the basic format here.

Their version of the markup is yet unknown as well as a low priority item for research right now.

ydkhatri avatar Dec 12 '18 02:12 ydkhatri

I'm guessing it's an NSAttributedString, but I don't know enough about Objective-C and especially its serialization format to know how to interpret the data.

bshannon avatar Dec 12 '18 06:12 bshannon

Having the formatting data would be super useful to me. 👍

sweenzor avatar Jan 18 '19 01:01 sweenzor

It's all there, if you can figure out how to make sense of it. I've been working on it, and have made some progress, but there's still a lot of guesswork involved.

bshannon avatar Jan 19 '19 03:01 bshannon

Please share your findings, either publicly or privately.

ydkhatri avatar Jan 19 '19 04:01 ydkhatri

@bshannon please do share! happy to help build on what you've got 👍

sweenzor avatar Jan 21 '19 01:01 sweenzor

I've created a first cut at documenting the format here. Java source code coming soon...

Let me know of any questions.

bshannon avatar Jan 27 '19 02:01 bshannon

Fantastic! Thanks for sharing.

Is it possible that the previous HTML formatting is just being loaded into an NSAttributedString?

See the "Loading an attributed string from HTML" section of this article: https://www.hackingwithswift.com/articles/113/nsattributedstring-by-example

sweenzor avatar Jan 27 '19 19:01 sweenzor

It's being "loaded" in the sense that it reads and parses the html and converts it into the closest equivalent NSAttributedString attributes. The original html tags are lost.

bshannon avatar Jan 27 '19 19:01 bshannon

Hoping that you've had a breakthrough since January! 😄

sweenzor avatar Apr 07 '19 19:04 sweenzor

Try my savenotes program.

bshannon avatar Apr 12 '19 06:04 bshannon

I will. Thank you @bshannon!

sweenzor avatar Apr 12 '19 06:04 sweenzor