stefanopagliari / bibnotes

359 stars 30 forks source link

[bug] The {{comment}} is not formatted correctly #161

Open zhuyinna opened 1 year ago

zhuyinna commented 1 year ago

when I set the formmat of {{hightlight}} is "quotation marks", and set the formmat of {{comment}} is "Blockquote", the extracted annotation will like this: 1679631318450 You can find that that {{highlight}} part is correct, but in the {{comment}} part, there's a quotation mark in the beginning. But I didn't set "quotation marks" in the setting.

After checking the source code, I found the bug.

In line 5118~5120 of the main.js, the original code is:

const highlightFormatBeforeColoured = highlightFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");
const commentFormatBeforeColoured = highlightFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");
const tagFormatBeforeColoured = highlightFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");

will result that the commentFormatBefore is same as the highlightFormatBefore. So it should changed to:

const highlightFormatBeforeColoured = highlightFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");
const commentFormatBeforeColoured = commentFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");
const tagFormatBeforeColoured = tagFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");

What's more, there are also two little bugs: (1) in line 4473, highlightColouredBefore = '<mark style="background: SELECTED_COLOUR>'; there lacks a Double quotation marks before ">" (2) in line 4495, the original code is

const commentFormatBefore = commentHighlighted + commentColouredBefore;
commentBold + commentItalic + commentQuoteOpen;

the sentence was incorrectly wrapped. It should changed to : const commentFormatBefore = commentHighlighted + commentColouredBefore + commentBold + commentItalic + commentQuoteOpen;

77-arthur commented 1 year ago

你好,请问导出{{comment}}是否需要额外配置?我看默认配置会导出{{comment}},不过我生成的md一直只有{{highlight}}

zhuyinna commented 1 year ago

你好,请问导出{{comment}}是否需要额外配置?我看默认配置会导出{{comment}},不过我生成的md一直只有{{highlight}}

设置里需要这么改,最后的{{tag}}可以不要,顺序也可以换 image

77-arthur commented 1 year ago

你好,请问导出{{comment}}是否需要额外配置?我看默认配置会导出{{comment}},不过我生成的md一直只有{{highlight}}

设置里需要这么改,最后的{{tag}}可以不要,顺序也可以换 image

好的谢谢!

jinzhi666 commented 1 year ago

when I set the formmat of {{hightlight}} is "quotation marks", and set the formmat of {{comment}} is "Blockquote", the extracted annotation will like this: 1679631318450 You can find that that {{highlight}} part is correct, but in the {{comment}} part, there's a quotation mark in the beginning. But I didn't set "quotation marks" in the setting.

After checking the source code, I found the bug.

In line 5118~5120 of the main.js, the original code is:

const highlightFormatBeforeColoured = highlightFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");
const commentFormatBeforeColoured = highlightFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");
const tagFormatBeforeColoured = highlightFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");

will result that the commentFormatBefore is same as the highlightFormatBefore. So it should changed to:

const highlightFormatBeforeColoured = highlightFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");
const commentFormatBeforeColoured = commentFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");
const tagFormatBeforeColoured = tagFormatBefore.replace("SELECTED_COLOUR", lineElements.highlightColour + ";");

What's more, there are also two little bugs: (1) in line 4473, highlightColouredBefore = '<mark style="background: SELECTED_COLOUR>'; there lacks a Double quotation marks before ">" (2) in line 4495, the original code is

const commentFormatBefore = commentHighlighted + commentColouredBefore;
commentBold + commentItalic + commentQuoteOpen;

the sentence was incorrectly wrapped. It should changed to : const commentFormatBefore = commentHighlighted + commentColouredBefore + commentBold + commentItalic + commentQuoteOpen;

你好,我也发现了这些BUG。转换 JSON 文件中的大纲标题 <h1> title1 </h1> 无法转换为 markdown 的 # title1,请问如何解决呢?