mgmeyers / obsidian-pandoc-reference-list

Display a formatted reference in Obsidian's sidebar for each pandoc citekey in the active document.
GNU General Public License v3.0
172 stars 9 forks source link

Pandoc Citations causes weird duplication of text in paragraph in Reading Mode #109

Open ReaderGuy42 opened 5 months ago

ReaderGuy42 commented 5 months ago

Pandoc Citations [@Citekey] cause a weird duplication of a part of the paragraph the citation is in.

This is in regular Edit Mode:

image

And this is that same paragraph, with part of the text duplicated, note the highlighted portion which appears duplicate. Also the portion after the citation is also duplicated.

image

Any ideas how to fix this? Thanks!

r-curry commented 4 months ago

I also seem to be seeing this issue. Appreciate any tips on a fix.

FeralFlora commented 4 months ago

I can replicate this: Obsidian_KtiTx9NOUl

Any text on the same line as a citekey is duplicated in Reading mode. The citekey styling also extends to the non-duplicated text.

Citation rendering in reading mode must be off for this to occur. So, until a fix is out, enabling citation rendering is a viable workaround.

Jmuccigr commented 2 weeks ago

Just noting that this is still a problem.

Here is a simple text example of how the citation causes duplication of text in the same paragraph. I put the text into Obsidian and then copied the results. The first line is what you see in Reading mode; the second (in code blocks) is what's in the source.

First in plain text, and everything before and after is duplicated as a block. I'm using short text here, but longer text gets duplicated as well:

The Citekey:: The Citekey:: @Smith1931 a good book a good book

The Citekey:: @Smith1931 a good book

Italic formatting (*) stops duplication in preceding text on the left. Note that the un-italicized colons are still duplicated, but the "The" which precedes the italic isn't. This works with ~~ or ** or ` as well:

The Citekey:: :: @Smith1931 a good book a good book

The *Citekey*:: @Smith1931 a good book

Italic works on the right side too:

The Citekey:: The Citekey:: @Smith1931 a good book

The Citekey:: @Smith1931 *a good* book

Even just one asterisk works for the text to the left, though Obsidian will italicize the entirety of the line to the right. Preceding the asterisk with a backslash to make it a literal removes the protection and everything is duplicated again (not shown):
The Citekey:: The Citekey:: @Smith1931 a good book a good book

The Citekey*:: @Smith1931 a good book

Not surprisingly italicizing the reference itself results in no duplication.

This effect happens on any text in the same markdown paragraph (block?) as the citation, so a new line won't prevent it, but two spaces at the line end will. (Not shown.)