gkeepapi
gkeepapi copied to clipboard
New Keep Note Formatting Availability?
Hi! The Keep note formatting option began rolling out last week to all users. I just received the update. However, I don't see any way to access the formatting in gkeepapi. Maybe I don't see it. It seems the nodes return title and text attributes but the text does not have any formatting embedded.
I assume they've done something similar to what Google Docs does where formatting is a separate attribute list array like [start char, len, format].
Any ideas?
Here is what the outer html looks like in the browser for a note with Bold, Underline and Italics. Looks like the data-ri= might be the offset reference (the text formatting button is in the lower left of the image):
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation" class="">
<span style="font-size:11pt;font-family:'Google Sans Text';color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;" data-ri="0">The </span>
<span style="font-size:11pt;font-family:'Google Sans Text';color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;" data-ri="1">Last of Us</span>
<span style="font-size:11pt;font-family:'Google Sans Text';color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;" data-ri="2"> is set twenty years into a pandemic caused by a mass fungal infection, which causes its hosts to transform into zombie-like creatures and causes the collapse of society. It follows Joel (</span>
<span style="font-size:11pt;font-family:'Google Sans Text';color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:underline;-webkit-text-decoration-skip:none;text-decoration-skip-ink:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;" data-ri="3">Pedro Pascal</span>
<span style="font-size:11pt;font-family:'Google Sans Text';color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;" data-ri="4">) and Ellie (</span>
<span style="font-size:11pt;font-family:'Google Sans Text';color:#000000;background-color:transparent;font-weight:400;font-style:italic;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;" data-ri="5">Bella Ramsey</span>
<span style="font-size:11pt;font-family:'Google Sans Text';color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;" data-ri="6">), who travel across the United States in the first season, based on 2013's The Last of Us. April 15, 2025 #tvshows</span>
</p>
One interesting observation - in the Google Takeout backup of a formatted note, I see a new attribute called "textContentHtml" - that might be what is needed:
...."text":(non formatted note text) ..."title":"Today","userEditedTimestampUsec":1747240945796000,"createdTimestampUsec":1744733722783000,"textContentHtml":"<span...(the html of the formatted note)....
Any thoughts on this @kiwiz ?
Haven't looked at the wire format yet, but a few thoughts.
We could expose a new text_md field that:
- parses markdown into the internal format when set
- generates markdown from the internal format when get
I'm not sure what to do when a user sets text, however. It could either:
- delete all attribute data
- update the text alone (with the consequence that attribute offsets will become out of sync)
Not sure myself. Maybe a look at the wire format will tell more.
The client/server appear to be sending deltas. Sample payload:
{
"clientRevision":"35",
"commandBundles": [
{
"sessionId":"123456789",
"requestId":"17",
"serializedCommands": "[[\"docs-nestedModel\",[\"text\",1,\"sct.id\"],{\"ty\":\"as\",\"st\":\"text\",\"si\":1,\"ei\":1,\"sm\":{\"ts_ff_i\":true,\"ts_bd_i\":false,\"ts_bd\":true,\"ts_tw\":400}}]]"
}
]
}
Notes:
- The
CLcapability determines whether deltas are sent - Updating the
textvalue ingkeepapiresults in the formatting desyncing
Any updates on this? (thx for 0.17.0 - that worked for archiving)