joplin / plugin-bibtex

Use locally stored BibTeX files to integrate citation into Joplin
30 stars 7 forks source link

Customize the rendering of inline references #27

Open xUser5000 opened 3 years ago

xUser5000 commented 3 years ago

This PR is not complete yet

What's done

Render all inline references that match the pattern [-@citekey] like (year)

What's left

Include all the other patterns described here

xUser5000 commented 3 years ago

Now it works on two patterns:

laurent22 commented 3 years ago

Did you manage to solve your issues? If not, please let me know and describe in details what the issue is.

xUser5000 commented 3 years ago

What has been done so far

Issues encountered

I want to execute some javascript code during the rendering of every reference. For some reason, just writing a <script> tag and putting the code inside it does not work. The only way I found to get it working was by doing sth like this: <style onload='${script.replace(/\n/g, " ")}' />, where the variable script is a string containing the desired JS code. This works but the downside is that, for some reason, whenever the style tag gets added to the note, everything after it just disappears from the document. For example, if the document contains the following:

<span class="hello">Hello Worl</span>
<style> .hello { font-weight: bold } </style>
This is just a sample text

The rendered content looks like this: Hello World

What's left to do

Implement the remaining patterns described here