notero icon indicating copy to clipboard operation
notero copied to clipboard

Customizable note headings

Open dvanoni opened this issue 1 year ago • 5 comments

CleanShot 2023-08-11 at 20 21 36@2x

To make it a little complicated: I would love A to be dropdown heading 2 and B to be dropdown heading 3. This fits my notion page the best. Finally the text in B is also referenced again below. Would it be possible to remove that part?

Originally posted by @ThomasDeLange in https://github.com/dvanoni/notero/issues/4#issuecomment-1676904491

dvanoni avatar Aug 15 '23 01:08 dvanoni

@ThomasDeLange, I pulled this out into a new issue so that we can discuss it separately.

It should be possible to allow customization of the heading levels used for the synced notes. I can add these as options in the Notero preferences, but this will be lower priority than some other improvements I'd like to get in place first.


As for the duplication of heading B, this is a bit tricky. What's happening here is that the title of the note item is used as the toggle heading (B), and the full content of the note is a child of the toggle heading.

CleanShot 2023-08-14 at 19 06 46@2x

As far as I can tell, Zotero uses the first line of the note content as the title of the note item. When the note has a heading at the start of it, you end up with the duplicated headings in Notion as you've seen.

The approach I've currently implemented is definitely the simplest since I don't have to do any special logic—I just use the title for the title and the content for the content. I could try to implement an approach where I omit the title from the content, but because of how the content is structured, this could be a little tricky. Another possible downside is that we could lose any formatting from the first line of a note (as in the screenshot above).

I agree that the current implementation doesn't look super great when the note starts with a heading, but I'm also struggling to come up with the best alternative that would support all scenarios. I'm open to suggestions!

dvanoni avatar Aug 15 '23 02:08 dvanoni

@dvanoni I understand, maybe some basic pattern matching or regex could help remove the title from the text? Since they are exactly the same this should work. Otherwise maybe counting the length of the title and removing that from the front of the text.

ThomasDeLange avatar Aug 17 '23 11:08 ThomasDeLange

Yeah, I think that would work. For scenarios where the first line of the note is a plain heading—like with the extracted annotations—it should be straightforward to match against the title text. And I think it's those scenarios where it's most desirable to have that duplicate heading omitted from Notion. 👍

dvanoni avatar Aug 18 '23 04:08 dvanoni

From @Pierre-Debraux in https://github.com/dvanoni/notero/issues/4#issuecomment-1853313031:

Would it be possible to not have a few levels of indentation ?

image

I agree the indentation is not ideal. It's currently implemented this way for technical reasons, specifically:

  • The top-level "Zotero Notes" toggle heading provides a container where Notero knows it can safely manage the content. By staying within this confined container, it avoids conflicting with anything else that a user may have entered into the Notion page themselves. I can think of some options around this:
    • Allow the user to disable the heading altogether. Notero would place notes directly on the page—which should be fine as long as the user doesn't intend to modify the page themselves.
    • Keep the heading, but don't make it a toggle heading (i.e. remove the indentation). As of earlier this year, the Notion API now supports an after parameter which would allow us to place content directly after the "Zotero Notes" heading without having to be indented.
  • The individual note toggle headings also provide a container for Notero to place their content. When a note is updated in Zotero, we actually delete the entire toggle heading and its children (the note content) and then recreate the note under a new toggle heading. We use this approach because of how the Notion API is structured. If we didn't have the note's content within a single container, updating a note would require deleting every piece of its content one by one. I've made an assumption that this would be too inefficient—especially for large notes—but it could be worth exploring to see how it behaves.

So, there are some options we may be able to try. 🙂 I'll share progress here when I'm able to dig into this.

dvanoni avatar Dec 13 '23 07:12 dvanoni

@dvanoni from my perspective, I think the top-level "Zotero notes" is good as it is. And as you explain, that way, Zotero knows where to put the notes and in the mean time, we can add whatever we want on the same page, but the notes are always at the same place.

It's more the "Annotations" toggle and then, the "Annotations" title that "annoy" me the most.

Still, it's no big deal, of course. But I think, they're unnecessary, at least in my use case.

Pierre-Debraux avatar Dec 13 '23 08:12 Pierre-Debraux