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
176 stars 9 forks source link

Recognize and render citekeys if precede by "(" #78

Open rauchert opened 1 year ago

rauchert commented 1 year ago

Hi there,

if my citekey is preceded by a round bracket it gets not recognized as a citekey and consequently also gets not rendered. So "(@citekey2000, 123)" will stay as it is and it is neither possible to jump to the corresponding literature note nor will I get the rendered citation "(Citekey 2000, 123). If, for example, there is a dash "-" before the citekey (which I never want) it IS recognized and rendered. This is the behavior I also would like for the bracket. I thought there has to be a place in the code, where I can define "(" to be ignored like "-", but I did not find it yet.

Could anybody help me?

Thank you :)

rauchert commented 11 months ago

The problem can be solved by replacing the following string "\t\v[-\r\n;]/" with "\t\v[(\r\n;]/" in the main.js in your local obsidian plugins folder. In the github-files, this string is the value of the constant preKey in parser.ts.

It is a bit hacky and I don't know, if it could have any unwanted consequences.

I came up with this solution and then discovered that osmalpkoras integrated the same workaround in his fork of the pandoc-plugin a few days ago...I have not tried his fork yet.

FeralFlora commented 7 months ago

If, for example, there is a dash "-" before the citekey (which I never want) it IS recognized and rendered.

☝️ This is proper Pandoc citation syntax, but 👉 (@citekey2000, 123) is not.

However, I think it wouldn't hurt to be less strict within the working environment of Obsidian.