parent
cd7edb0f63
commit
d17d5dc025
|
|
@ -417,24 +417,34 @@ async function rehype2remark(rehype: HRoot) {
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
li: (h, node) => {
|
li: (h, node) => {
|
||||||
const mnode = defaultHandlers.li(h, node) as ListContent;
|
const mNode = defaultHandlers.li(h, node) as ListContent;
|
||||||
// If no more than 1 children, skip
|
// If no more than 1 children, skip
|
||||||
if (!mnode || mnode.children.length < 2) {
|
if (!mNode || mNode.children.length < 2) {
|
||||||
return mnode;
|
return mNode;
|
||||||
}
|
}
|
||||||
const children: any[] = [];
|
const children: any[] = [];
|
||||||
// Merge none-list nodes inside li into the previous paragraph node to avoid line break
|
// Merge none-list nodes inside li into the previous paragraph node to avoid line break
|
||||||
while (mnode.children.length > 0) {
|
while (mNode.children.length > 0) {
|
||||||
const current = mnode.children.shift();
|
const current = mNode.children.shift();
|
||||||
const cached = children[children.length - 1];
|
const cached = children[children.length - 1];
|
||||||
if (cached?.type === "paragraph" && current?.type !== "list") {
|
if (current?.type !== "list") {
|
||||||
cached.children.push(current);
|
if (cached?.type === "paragraph") {
|
||||||
|
cached.children.push(current);
|
||||||
|
} else {
|
||||||
|
// https://github.com/windingwind/zotero-better-notes/issues/1207
|
||||||
|
// Create a new paragraph node
|
||||||
|
const paragraph = {
|
||||||
|
type: "paragraph",
|
||||||
|
children: [current],
|
||||||
|
};
|
||||||
|
children.push(paragraph);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
children.push(current);
|
children.push(current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mnode.children.push(...children);
|
mNode.children.push(...children);
|
||||||
return mnode;
|
return mNode;
|
||||||
},
|
},
|
||||||
wrapper: (h, node) => {
|
wrapper: (h, node) => {
|
||||||
return h(node, "wrapper", toText(node));
|
return h(node, "wrapper", toText(node));
|
||||||
|
|
@ -803,12 +813,12 @@ function processN2MRehypeHighlightNodes(
|
||||||
const libraryType = uriParts[3];
|
const libraryType = uriParts[3];
|
||||||
const key = uriParts[uriParts.length - 1];
|
const key = uriParts[uriParts.length - 1];
|
||||||
if (libraryType === "users") {
|
if (libraryType === "users") {
|
||||||
openURI = "zotero://open-pdf/library/items/" + key;
|
openURI = "zotero://open/library/items/" + key;
|
||||||
}
|
}
|
||||||
// groups
|
// groups
|
||||||
else {
|
else {
|
||||||
const groupID = uriParts[4];
|
const groupID = uriParts[4];
|
||||||
openURI = "zotero://open-pdf/groups/" + groupID + "/items/" + key;
|
openURI = "zotero://open/groups/" + groupID + "/items/" + key;
|
||||||
}
|
}
|
||||||
|
|
||||||
openURI +=
|
openURI +=
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue