Comments (2)
Do you know if Notes stores hyperlinks in the same way that it does other text formatting? The biggest issue I have dealing with Notes content is that most export methods (including apple-notes-liberator
) don't preserve links.
For example, if you add some text to a note, e.g. "Wikipedia", and convert it into a link by selecting the text and pressing cmd-k then setting the destination to "https://www.wikipedia.org/", this works as a normal, clickable hyperlink within Notes. But once this note has been exported, you're left with just the word "Wikipedia" with no link/URL.
The only way I've found to preserve links is to select all the text in the note, copy it to the clipboard, and then paste it into another app that supports rich text. Not ideal for multiple notes, although the process could be scripted.
To sum up, I'm wondering whether "preserve links" is a separate feature request, or if it'd come "free" with text formatting. I spent some time browsing the database and it wasn't obvious to me where Apple is storing this information.
from apple-notes-liberator.
Hi there!
I've added rudimentary support for extracting links in v1.1.0
. Each extracted note now has a links
property, which contains a list of links, in order, extracted from the note. See Output Format for more information. This is only probably minimally useful, if at all, because the links are taken out of context of where they are in the note. It's a start though, and it should be enough to build upon in order to support links when implementing something like #19.
apple_cloud_notes_parser
extracts and preserves links in various output formats already, so you might try using that and see if it suits you. It is a really awesome project without which I wouldn't have been able to get even the slightest handle on Notes structure.
More detailed information
Yeah Notes does store hyperlinks in a similar way to other text formatting. It keeps a list of what it calls attribute runs
in the note protobuf. I like to think of these as formatting information objects. You can then go through the attribute runs, see what kind it is, and then map it back to its location in the actual note via the attribute run's length
property. Each attribute run
has a length
property, and the sum total length of all attribute runs in the list will equal the length of the note itself. Thus you can figure out where the attribute run
(or formatting information object as I like to think of it) belongs in the note by taking the sum of the lengths of all previous attribute runs in the list.
Example
// Pseudocode
// myNoteProto is a NoteStoreProto
note = myNoteProto.document.note
noteText = note.noteText
formattingInformationObjects = note.attributeRunList
formattingObjectNoteTextIndex = 0
for each formattingInfo in formattingInformationObject
// current formattingInfo is located in note text at formattingObjectNoteTextIndex and continues for formattingInfo.length
// we could for example replace the note text between formattingObjectNoteTextIndex and formattingInfo.length with whatever
// representation of formattingInfo suits us best
// then we move along the formattingObjectNoteIndex in preparation for the next formattingInformationObject
formattingObjectNoteTextIndex += formattingInfo.length
Right now I'm not replacing any actual note text, but extracting the link text follows the same procedure. You can see it here:
I hope this helps a little bit!
from apple-notes-liberator.
Related Issues (20)
- Support checklists
- Add textbundle support HOT 2
- Update application version in nix shell HOT 3
- Support bullet points HOT 1
- Fix duplicated titles
- Support numbered lists HOT 1
- Support Github Flavored Markdown Spec HOT 1
- Place markdown notes into the same file hierarchy as they exist in Notes.app HOT 1
- Cannot invoke because return value of getzFolder() is null HOT 4
- upgrade to quarkus 3
- Look for data in all ZMERGABLEDATA columns
- Add option to disable Markdown header prefix and/or detect if title is already prefixed with the markdown header character HOT 1
- Make sure application can be run against Notes.app databases that don't have all columns in their schema HOT 5
- Can't run and successfully get past usage HOT 5
- -f or --file not working HOT 3
- Cannot invoke "java.lang.Integer.intValue()" because "rowIndex" is null HOT 8
- update quarkus
- improve logging
- Markdown files are empty
- SQL Error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apple-notes-liberator.