Closed HeinzContiZacherl closed 10 months ago
Update: 19.12.23
The issue with "<b>:-></b>
" appearing in Anki cards might stem from two factors. Firstly, in Logseq, ":->
" is automatically converted to ":→
", which could be happening before syncing with Anki, causing unexpected formatting. Secondly, there's an HTML code issue where HTML entities for bold tags are being rendered as actual tags. The problematic code is <span>Systemmonitor anzeigen<b>:-></b> {{c1::<code>top</code>.}}</span>
, which displays as "Systemmonitor anzeigen<b>:-></b> {{c1::top.}}
". The solution is to remove the bold tag entities from the code, updating it to <span>Systemmonitor anzeigen:-> {{c1::<code>top</code>.}}</span>
, which should correctly display ":->
" without bold formatting.
Could it possibly be a solution to change add the following lines to your converter-code?
`// Render the markdown resultContent = Mldoc.export( "html", resultContent, JSON.stringify(mldocsOptions), JSON.stringify({}), );
// Replace ":→" with ":->" only if ":→" is present if (resultContent.includes(":→")) { resultContent = resultContent.replace(/:→/g, ":->"); }`
Issue is occurring due to no space before ":->".
The bold tags are first being added here: https://github.com/debanjandhar12/logseq-anki-sync/blob/2efe2f231b352c88572e563c91f73414ccb8eefe/src/notes/SwiftArrowNote.ts#L48
and then passed to: https://github.com/debanjandhar12/logseq-anki-sync/blob/2efe2f231b352c88572e563c91f73414ccb8eefe/src/notes/SwiftArrowNote.ts#L59
The converter internally uses mldoc which require html code to be space separated. However, earlier, we didn't add space.
Replacing the above line of SwiftArrowNote with below should fix it:
replacement += `${beforeArrowSpace}${beforeArrowSpace.endsWith(" ") ? "" : " "}<b>${g3}</b>${afterArrowSpace}`;
Great! I just added a space before ":->" to my notes in Logseq and it worked. Now the Anki cards are correct.
Do you think you could add this little change to future releases or mention the needed space on the documentation? I think that would improve your addon even further.
I want to really thank you for your work. Im a newbie coder and couldn't solve it myself. Your addon changed my academic life.
I'm glad the plugin has been helpful for you. I have included the fix and will do a release with it included soon.
Describe the bug A clear and concise description of what the bug is: Anki card contains
<b>:-></b>
instead of:->
Steps to Reproduce: Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen. On Anki cards should look like this:
Developer console screenshot: Please add a screenshot of the error in logseq's developer console if applicable. Logseq's developer console can be accessed by pressing
Ctrl + Shift + I
.Device Information (please complete the following information):