Markdown export: Colors and tags in output
dstillman
Zotero Team
This discussion was created from comments split from: Available for beta testing: Markdown export of notes.
Upgrade Storage
But can I just confirm that it is presently impossible to export the colours of highlights to markdown from the new PDF editor?
Equally, that the the tags on annotations don't for the moment export?
The obvious workaround, if you're exporting to Obsidian, is to add tags manually for the categories that we might use colours and tags for.
eg #checkthis #srsly-huh #crucial or #disputed
and I am happy to do this, which is only a few more keystrokes. But I just want to be sure that this is the only way to do it for the moment, and that any plans to format the Markdown from within Zotero are at the moment still just plans
Do you want to be able to add manual labels to colors? Do you want to simply associate a color with a tag, such that choosing a color was equal to adding a specific tag? Do you want those color labels to be document-specific (such that you had to assign them again in every new document) or global across all documents (such that changing a color label in one place would affect the meaning of the color in all previously annotated documents)? In a group library, should color labels be shared with and editable by all group members?
These are tricky questions, which is why we opted to keep colors and tags separate and keep colors unlabeled in the initial version. Correct. But that will certainly be possible in a future version.
Speaking for myself, I would strongly prefer the colour-label associations to be document specific, for two related reasons.
1) the range of characteristics salient enough to be tagged is very wide and varies between documents: a colour/tag might represent a theme in a long document; it might represent an action to be taken; it might represent a reader's reaction; in a playscript it could be something as simple as a character's speech or PoV. Any particular document is going to be tagged in only a subset of these possible ways, probably no more than five. But we don't know which five in advance
2) asking people to choose a group of colours/tags is unrealistic at the start of a project but changing things retrospectively at the end of a project or the start of a new one is going to be very confusing.
I don't think those points will prove very controversial — though it would obviously be good to have a set of sensible defaults.
As to the question of hard-coding colours: I think it would be a reasonably compromise for Zotero to offer a range of seven colour names/swatches (isn't that what it does now?) and for users to be able to map the colours used in other programs onto these. The reason being that most people are unlikely to want to use, or to be able to distinguish, a large number of highlight shades.
Giving them names would allow customisation both on the importing and the exporting sides of Zotero, so that people could see the exact shades they preferred in external PDF readers or the reader apps for exported notes.
For the moment, though, the most useful thing would be the ability to export the tags on individual annotations with or without the coloured highlights.
Additionally, I'd love it if I could have my notes appear in a block quote and my highlights appear normally. It helped visually to see where my ideas were. That was a nice feature in Zotfile.
Finally, I use Acrobat for annotating and highlighting. For some reason, using this beta feature, when I click on the "Show on Page" link, it just opens the document to the very beginning as opposed to taking to where the highlight is.
Nice work! I've got the block quotes working as intended, the only thing that is a little weird is that it adds a blank block quote even if there is not a comment (that's only when I'm viewing the note in Zotero though, when I copy all and paste it into a new note in Obsidian, there are no empty block quotes).
<p>{{highlight quotes='true'}} {{citation}}</p>{{if comment}}<blockquote>{{comment}}</blockquote>{{if color == '#ff6666'}}<mark style="background: #ff6666; "><p>{{highlight}} {{citation}}</p> {{if comment}}<blockquote>{{comment}}</blockquote>{{endif}}</mark>
{{elseif color == '#2ea8e5'}}
<mark style="background: #2ea8e5; "><p>{{highlight}} {{citation}}</p> {{if comment}}<blockquote>{{comment}}</blockquote>{{endif}}</mark>
{{elseif color == '#5fb236'}}
<mark style="background: #5fb236; "><p>{{highlight}} {{citation}}</p> {{if comment}}<blockquote>{{comment}}</blockquote>{{endif}}</mark>
{{elseif color == '#a28ae5'}}
<mark style="background: #a28ae5; "><p>{{highlight}} {{citation}}</p> {{if comment}}<blockquote>{{comment}}</blockquote>{{endif}}</mark>
{{else}}
<mark style="background: #ffd400; "><p>{{highlight}} {{citation}}</p> {{if comment}}<blockquote>{{comment}}</blockquote>{{endif}}</mark>
{{endif}}
<i></i>and<b></b>why doesn't the other code register, if the notes are in markdown?<p>{{highlight quotes='true'}} {{citation}}</p>{{if comment}}<blockquote>{{comment}}</blockquote>{{endif}} {{if tags}} <blockquote><b>Tags:</b> #{{tags join=' #'}}</blockquote>{{endif}}While it probably can't be used by any external application for direct import at least there is now an annotation with a note and accompanying tags.
11 May 2022: I tried setting extensions.zotero.annotations.noteTemplates.highlight to this with great effect for importing into Obsidian:
<p>{{highlight quotes='true'}} {{citation}}</p>{{if comment}}<blockquote>{{comment}}</blockquote>{{endif}} {{if tags}} <blockquote><b>Tags:</b> [[{{tags join=']] [['}}]]</blockquote>{{endif}}It will automatically include the tags associated with the Notes added to a PDF.
I will add I am very much a novice in this realm. I'm still trying to find my research feet.
Hope this helps.
God Bless
I am trying to get info about my highlight colouration into Obsidian. I modified the extensions.zotero.annotations.noteTemplates.highlight to get a coloured square-like structure into my annotations (
<blockquote><span style="background-color:{{color}}">|–|</span> {{highlight quotes='true'}} {{citation}} {{comment}}</blockquote>). No problem to make it work a this point. I have lovely squares of colour as wanted. But then, when I try to export it to Markdown (and into Obsidian), the span command is forgotten, and I only get a sad colourless square. Did I make something wrong? Did I forget something important?Thanks in advance!
You can export in HTML mode if you want to preserve the HTML.
Thanks for your answer! Well, I do not know what I was expecting, but from an amateur point of view, what I thought about made sense to me.
I tried incorporating HTML, but then it is the Extract Annotations function which deletes the code, even before exporting to Markdown.
I am really sorry to bother you with this issue of mine. I thought getting the highlighting colours into my Obsidian notes would be easier...
I do agree that there should be a way to export highlight colors--it seems odd that they get lost. Zotfile export highlight colors.
@dstillman I understand better how it is working now. Thanks a lot for your answer!