A bug related to markdown escaping when exporting extracted annotations
If one copies the contents in an extracted annotations of a pdf, then paste in a markdown editor, e.g., obsidian, some symbols are escaped incorrectly. Examples can be found in the link below (where I placed some images ): https://github.com/zotero/zotero/issues/2343
When searching for a solution, I found the above github issue, and tried the following:
I copied the main.js and translator.js into the folder "...\Zotero\translators", then restarted zotero. Seems that something takes effect, for example, if I copy the notes and press Ctrl+Shift+V in a obsidian note, then the escape signs are no longer there. However, all the links (related to the annotation in the pdf) are gone, and these links are gone even if I paste them using Ctrl+V.
Besides, a wierd thing is that, the main.js, which I copied into the folder, is deleted automatically during the restart of zotero. This happens even if I copy it into the folder again. Now I tried deleting these two files from the folder, but the behavior won't recover.
The snapshots are also attached in the above link. Could someone help me solve this issue, or at least recover the behavior of how zotero handles the export, so that the links can be kept?
When searching for a solution, I found the above github issue, and tried the following:
I copied the main.js and translator.js into the folder "...\Zotero\translators", then restarted zotero. Seems that something takes effect, for example, if I copy the notes and press Ctrl+Shift+V in a obsidian note, then the escape signs are no longer there. However, all the links (related to the annotation in the pdf) are gone, and these links are gone even if I paste them using Ctrl+V.
Besides, a wierd thing is that, the main.js, which I copied into the folder, is deleted automatically during the restart of zotero. This happens even if I copy it into the folder again. Now I tried deleting these two files from the folder, but the behavior won't recover.
The snapshots are also attached in the above link. Could someone help me solve this issue, or at least recover the behavior of how zotero handles the export, so that the links can be kept?
I have also tried different notetemplate strings, such as:
{{highlight}} {{citation}} {{comment}}{{if tags}} #{{tags join=' #'}}{{endif}}
The output looks like this:"Ctrl+V
# Annotations
(28/08/2022, 08:17:35)
“Development of a Novel 3-DoF Purely Translational Parallel Mechanism” (Yunjiang Lou et al., 2007, p. 169)
“In view of the successful application of planar parallelogram in the Delta robot and its variants, we are interested to investigate mechanisms consisting of spatial parallelograms.” (Yunjiang Lou et al., 2007, p. 169)
“Using the formulation of maximizing effective cubic workspace, the Orthopod,” (Yunjiang Lou et al., 2007, p. 169)
Ctrl+Shift+v:
Annotations(28/08/2022, 08:17:35)
“Development of a Novel 3-DoF Purely Translational Parallel Mechanism”
“In view of the successful application of planar parallelogram in the Delta robot and its variants, we are interested to investigate mechanisms consisting of spatial parallelograms.”
“Using the formulation of maximizing effective cubic workspace, the Orthopod,”
"
Notice that, when using Ctrl+Shift+V, the formatting seems to be lost, for example, The linebreak within Annotations(28/08/2022, 08:17:35) is lost, and "Annotations" is no longer recognized as a heading, which is thus not bolded.
For Obsidian, see https://forums.zotero.org/discussion/comment/409004#Comment_409004
However, currently, the problem of the extra escape before ">", "[", "]" still exist, which should be hopefully solved in the future.
Another related issue: if I paste into obsidian using Ctrl+Shift+V, the images won't be copied properly. Only a link to the item is kept. Below is an example:
([Chouaibi et al., 2016, p. 3](zotero://select/groups/27057**/items/X4JT**FP))
\>\[!done\] “rm, while x0 is taken according to the right hand rule. Let S11(A1,x11,y0,z11), the reference frame fixed on the arm (2). The z11 is parallel to the line A1F1 (F1 corresponds to the middle of the segment C1C′” ([Chouaibi et al., 2016, p. 2](zotero://select/groups/27057**/items/X4JT4F**)) ([pdf](zotero://open-pdf/groups/27057**/items/QSU4QU**?page=3&annotation=D4LJP6**))
([Chouaibi et al., 2016, p. 3](zotero://select/groups/27057**/items/X4JT4F**))
For the escaping, make sure you have translator updating enabled in the Advanced pane of the preferences, and click Update Now for good measure. If you're still seeing escaped brackets after that, provide a Debug ID for copying.
The noteTemplates.Highlight is set as follows:
[removed irrelevant note template — D.S.]
The debug ID is below: D1689862257
Based on other errors in your error report, the update request might be getting blocked by your internet connection.
The ID is D580804468
D159387257
">[!warning] “wn in Figs. 2 and 3). Two forearms (3) and (3′) are connected to the arm (2) by two spherical joints centered at C and C′. The line CC′ is taken parallel to i. These two forearms (3) and (3′) are als” (Chouaibi et al., 2016, p. 2)
>[!danger] “(4) is connected to the platform by a revolute joint with axis taken parallel to i, in order to eliminate all possible rotations of the platform with respect to the base. The axes of the first revolute joints con” (Chouaibi et al., 2016, p. 2)
"
the links are again missing.
Moreover, I can no longer drag an annotation directly into obsidian, a symbol of cicle with a backlash appears, which means forbidden.
the results is as follows:
Ctrl+V
[!warning] “wn in Figs. 2 and 3). Two forearms (3) and (3′) are connected to the arm (2) by two spherical joints centered at C and C′. The line CC′ is taken parallel to i. These two forearms (3) and (3′) are als”
[!danger] “(4) is connected to the platform by a revolute joint with axis taken parallel to i, in order to eliminate all possible rotations of the platform with respect to the base. The axes of the first revolute joints con”
[!done] “rm, while x0 is taken according to the right hand rule. Let S11(A1,x11,y0,z11), the reference frame fixed on the arm (2). The z11 is parallel to the line A1F1 (F1 corresponds to the middle of the segment C1C′”
Ctrl+Shift+V:
[removed duplicate output — D.S.]
Then I tried another md editor I have, and tried notepad, the results are the same for all cases.
Might the problem be because that the translators are not fully updated?
So then the escaping is fixed, right?
For the links, reset your note template to the default and test again.
I just reset the note template to default, the extracted notes changes format as expected, but the links (including the name for the links) are still gone. The related ID is: D1430924622
```
“wn in Figs. 2 and 3). Two forearms (3) and (3′) are connected to the arm (2) by two spherical joints centered at C and C′. The line CC′ is taken parallel to i. These two forearms (3) and (3′) are als”
“(4) is connected to the platform by a revolute joint with axis taken parallel to i, in order to eliminate all possible rotations of the platform with respect to the base. The axes of the first revolute joints con”
“rm, while x0 is taken according to the right hand rule. Let S11(A1,x11,y0,z11), the reference frame fixed on the arm (2). The z11 is parallel to the line A1F1 (F1 corresponds to the middle of the segment C1C′”
```
If I use Ctrl+V, the image can be pasted properly, though with an extremely long name, while the links are missing; if I use Ctrl+Shift+V, the links are there but the image is not (when the translators are not updated);
If I successfully solve the translator issue, can I paste the image and links properly in obisidan, using Ctrl+Shift+V or Shift+Drag? If not, it may be better to consider using other plugins for the communication between zotero and obsidian.
D1779151383
Below is the output using default note template:
# Annotations
(28/08/2022, 22:00:08)
“The remainder of this article is organized as follows. In the next section,” ([Staicu et al., 2018, p. 2](zotero://select/groups/27057**/items/PGSXL5FQ)) ([pdf](zotero://open-pdf/groups/27057**/items/JJKRJLP4?page=2&annotation=KJZ4VCGR))
“Considering the symmetric structure of the” ([Staicu et al., 2018, p. 4](zotero://select/groups/27057**/items/PGSXL5FQ)) ([pdf](zotero://open-pdf/groups/27057**/items/JJKRJLP4?page=4&annotation=Z3RFQJKW)) user comments
Below is the output using the template I created
# Annotations
(28/08/2022, 21:55:33)
\>[!danger] “The remainder of this article is organized as follows. In the next section,” ([Staicu et al., 2018, p. 2](zotero://select/groups/27057**/items/PGSXL5FQ)) ([pdf](zotero://open-pdf/groups/27057**/items/JJKRJLP4?page=2&annotation=KJZ4VCGR))
\>[!note] “Considering the symmetric structure of the” ([Staicu et al., 2018, p. 4](zotero://select/groups/27057**/items/PGSXL5FQ)) ([pdf](zotero://open-pdf/groups/27057**/items/JJKRJLP4?page=4&annotation=Z3RFQJKW)) user comments
#testtags
I also tried pasting an image, for both cases the image is not pasted when using Ctrl+Shift+V
Below is the debug ID: D290113542.
We can look into not escaping angled brackets.
Another remaining issue is, it is not importing the images properly. Below is an example of two comments (extracted from a normal text and an image):
"# Annotations
(29/08/2022, 07:19:53)
\>[!note] “Given Cartesian position p, taking norm of both s” ([Lou et al., 2006, p. 2147](zotero://select/groups/27057**/items/6T7GZRUN)) ([pdf](zotero://open-pdf/groups/27057**/items/9PK77JRI?page=4&annotation=J3J9RLVI))
([Lou et al., 2006, p. 2147](zotero://select/groups/27057**/items/6T7GZRUN))
"
As can be seen, the link for the image leads to the item rather than the annotated snapshot. This test is done on a clean pdf.
If the images can be made to be pasted properly in the future, it would be very convienient if an "!" symbol is added automatically before the left bracket of the image link, so that the images can be embedded directly into the obsidian notes, which can be displayed when switched to the preview mode in obsidian.
I acknowledge that it is likely that some others may don't like the automatic "!", but if one needs to add "!" by himself one by one, it is a challenging task; on the other hand, removing all the "!" from a note can be done simply upon replacing "(![" with "([" in batch, will is much simpler.
I would recommend the developers to consider offering a way to paste the images with the appropriate link and the automatic "!"
{{if color == '#ff6666'}}
<blockquote>[!danger] {{highlight quotes='false'}} {{citation}} {{if comment}} {{comment}} {{endif}} <br /> {{if tags}} #{{tags join=' #'}}{{endif}} </blockquote>
{{elseif color == '#ffd400'}}
<blockquote>[!warning] {{highlight quotes='false'}} {{citation}}{{if comment}} {{comment}} {{endif}} <br /> {{if tags}} #{{tags join=' #'}}{{endif}}</blockquote>
{{elseif color == '#5fb236'}}
<blockquote>[!done] {{highlight quotes='false'}} {{citation}} {{if comment}} {{comment}} {{endif}} <br /> {{if tags}} #{{tags join=' #'}}{{endif}}</blockquote>
{{elseif color == '#2ea8e5'}}
<blockquote>[!note] {{highlight quotes='false'}} {{citation}} {{if comment}} {{comment}} {{endif}} <br /> {{if tags}} #{{tags join=' #'}}{{endif}}</blockquote>
{{elseif color == '#a28ae5'}}
<blockquote>[!example] {{highlight quotes='false'}} {{citation}} {{if comment}} {{comment}} {{endif}} <br/> {{if tags}} #{{tags join=' #'}}{{endif}}</blockquote>
{{else}}
<blockquote>[!] {{highlight quotes='false'}} {{citation}} {{if comment}} {{comment}} {{endif}} <br/> {{if tags}} #{{tags join=' #'}}{{endif}}</blockquote>
{{endif}}
https://github.com/zotero/zotero/issues/2343
Please start new threads for new issues (but see existing threads on images in Markdown).