Inserting a link to another note in the middle of a note inserts at the end of the note. #1488
-
Is there an existing issue for this?
Are you using the latest Zotero and the latest plugin?
Environment
Describe the bugSimilar to #1239, when I insert a link to another note using “Link To” in the middle of a note—that is, using “Insert To:” and choosing an item from the Table of Contents—the link always appears at the bottom of the note…the first time. If I perform the same action a second time, or edit the note at all before I use “Link To,” the link appears where it should. Debug OutputAnything else?First attempt: Second attempt (correct): |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
|
Is the note generated by a template and not edited since then? The note parsing relies on some implicit rules (like no multiple row-elements should be in the same row), while some templates may not obey them, and it will only be auto-formatted the next time the note is saved via the note editor. Try to edit the note (like typing a space) and then redo. If it then works, we can try to figure out what should be corrected with your template. |
Beta Was this translation helpful? Give feedback.
-
Yes.
Yes, that works consistently. The template is Reference Note. |
Beta Was this translation helpful? Give feedback.
-
|
bump |
Beta Was this translation helpful? Give feedback.
-
Consider using the markdown mode instead of the raw HTML, so that the content are automatically parsed (to the best effort). Fixed version: # This template is specifically for importing/sharing, using better
# notes 'import from clipboard': copy the content and
# goto Zotero menu bar, click Tools->New Template from Clipboard.
# Do not copy-paste this to better notes template editor directly.
# Based on [Paper Notes](https://github.com/windingwind/zotero-better-notes/discussions/1099)
name: "[item]Reference Note"
zoteroVersion: "8.0.SOURCE.a2a6df529"
pluginVersion: "3.0.0-beta.2"
savedAt: "2025-11-15T22:17:54.571Z"
content: |-
# Format from https://github.com/windingwind/zotero-better-notes/discussions/1246#discussioncomment-11752668
# This uses the [Reference Note citation style](https://github.com/Calorion/zotero-better-notes-reference-note-template)
<h1><a href="zotero://select/items/1_${topItem.key}">${Zotero.QuickCopy.getContentFromItems([topItem],'bibliography=1312348e-7e30-40e8-ae0a-20b3d3f030b6').html.replaceAll("\n", "")}</a></h1>
<p><i>Reference notes</i></p>
<h2>Metadata</h2>
<ul>
<li>
<strong>Item Type: </strong>${topItem.itemType}
</li>
<li>
<strong>Date Added: </strong>${new Date().toLocaleString()}
</li>
<li>
${{
const doi = topItem.getField("DOI");
if (doi) {
return `<b>DOI: </b> <a href="https://doi.org/${topItem.getField('DOI')}">${topItem.getField('DOI')}</a>`;
} else {
return `<b>URL: </b><a href="${topItem.getField('url')}">${topItem.getField('url')}</a>`;
}
}}$
</li>
<li>
<strong>Attachments: </strong>
${{
const attachments = Zotero.Items.get(topItem.getAttachments());
const pdf = attachments.filter((i) => i.isPDFAttachment());
if (pdf && pdf.length > 0) {
return `<a href="zotero://open-pdf/library/items/${pdf[0].key}">${pdf[0].getFilename()}</a>`;
} else if (attachments && attachments.length > 0) {
return `<a href="zotero://open-pdf/library/items/${attachments[0].key}">${attachments[0].getFilename()}</a>`;
} else {
return ``;
}
}}$
</li>
</ul>
<h2>↑Referred from</h2>
<h2>↓References</h2>
<h2>↔︎Related to</h2>
<h2>Source notes</h2>
<p></p> |
Beta Was this translation helpful? Give feedback.
-
|
But that loses my comments when I Share it, because they’re not imported to begin with. |
Beta Was this translation helpful? Give feedback.
-
|
Then consider using sth like this ( I also updated it to use markdown so that there's no risk of using unrecognized html tags. # This template is specifically for importing/sharing, using better
# notes 'import from clipboard': copy the content and
# goto Zotero menu bar, click Tools->New Template from Clipboard.
# Do not copy-paste this to better notes template editor directly.
name: "[item]Reference Note"
zoteroVersion: "8.0.SOURCE.a2a6df529"
pluginVersion: "3.0.0-beta.2"
savedAt: "2025-11-16T21:22:25.309Z"
content: |-
// @use-markdown
// @comment Based on [Paper Notes](https://github.com/windingwind/zotero-better-notes/discussions/1099)
// @comment Title
// @comment Format from https://github.com/windingwind/zotero-better-notes/discussions/1246#discussioncomment-11752668
// @comment This uses the [Reference Note citation style](https://github.com/Calorion/zotero-better-notes-reference-note-template)
# [${Zotero.QuickCopy.getContentFromItems([topItem],'bibliography=1312348e-7e30-40e8-ae0a-20b3d3f030b6').html.replaceAll("\n", "")}](zotero://select/items/1_${topItem.key})
_Reference notes_
## Metadata
- **Item Type:** ${topItem.itemType}
- **Date Added:** ${new Date().toLocaleString()}
- ${{
const doi = topItem.getField("DOI");
if (doi) {
return `**DOI:** [${topItem.getField('DOI')}](https://doi.org/${topItem.getField('DOI')})`;
} else {
return `**URL:** [${topItem.getField('url')}](${topItem.getField('url')})</a>`;
}
}}$
- **Attachments:** ${{
const attachments = Zotero.Items.get(topItem.getAttachments());
const pdf = attachments.filter((i) => i.isPDFAttachment());
if (pdf && pdf.length > 0) {
return `[${pdf[0].getFilename()}](zotero://open-pdf/library/items/${pdf[0].key})</a>`;
} else if (attachments && attachments.length > 0) {
return `[${attachments[0].getFilename()}](zotero://open-pdf/library/items/${attachments[0].key})</a>`;
} else {
return ``;
}
}}$
## ↑Referred from
## ↓References
## ↔︎Related to
## Source notes
<p></p> |
Beta Was this translation helpful? Give feedback.
-
|
Since it's not a bug, I'll convert it to discussions |
Beta Was this translation helpful? Give feedback.


Then consider using sth like this (
// @comment ...):I also updated it to use markdown so that there's no risk of using unrecognized html tags.