melat0nin / zotero-roam-export

A Zotero addon for exporting to Roam
MIT License
179 stars 12 forks source link

Export underlining issue #25

Closed cobblepot1 closed 4 years ago

cobblepot1 commented 4 years ago

First, thank you so much for this extension and implementing the citekey as title option!

When I export/import my Zotfile extracted annotations into Roam, my comments on the pdf (not highlights, but comments) are not formatted correctly. Zotfile is set at this default:

extensions.zotfile.pdfExtraction.formatAnnotationUnderline = <p>"<u>%(content)</u>" (%(cite))</p>

This produces the following text in Roam: __Here, he implies that existence beliefs are central to emotions. ([note on p.11](zotero://open-pdf/library/items/M8Z6HYN2?page=11))__

Because the double underscore follows the link, it does not properly italicize the text. It would be great if you can fix this to retain the italics formatting.

Also, I would like to automatically indent my comments on the extracted highlights so it looks like this:

I see the formatting tag option but I'm not sure how to utilize it. Can you explain? Do I just put <u> in that field?

melat0nin commented 4 years ago

The first problem is with Roam, unfortunately -- when italicised text includes a link the markdown parser seems to break and fail to italicise everything between the two sets of --. I imagine this will be fixed at some point but it's not part of the exporter. Having said that, looking at your Zotfile setting it doesn't look like there's any reason for the extracted text to be italicised -- the exporter doesn't by default convert either <p> or <u> tags into italics (see lines 258-259 of roamexport.js):

mapObj = {"<p>":"","</p>":"","<strong>":"**","</strong>":"**","<b>":"**","</b>":"**","<u>":"### ","</u>":"","<em>":"__","</em>":"__", "<blockquote>":"> ","</blockquote>":"","<br><br>":"\n\n"},

Have you changed something manually?

For your second issue, this is taken care of by the extensions.roamexport.indent_tag_as_child exporter option. You can set whatever tag you like and it'll always be indented under the preceding block. I have adapted my Zotfile settings to extract all my highlight-attached-notes as <blockquote>s, which I then target using the above preference to indent them, like this:

There's more info about these options in the README under Optional features. I hope to add them to a GUI sometime soon but have been very busy with other things the past few months.

cobblepot1 commented 4 years ago

Thanks for the response. I actually want my notes to look just like yours - the quote normal and the comment in italics. Can you share your Zotfile and any other relevant settings I need to do that?

melat0nin commented 4 years ago

Here are my settings:

cobblepot1 commented 4 years ago

Thanks!