OliverBalfour / obsidian-pandoc

Pandoc document export plugin for Obsidian (https://obsidian.md)
MIT License
691 stars 57 forks source link

Possible solution to the citation problem! #200

Open jeetsukumaran opened 9 months ago

jeetsukumaran commented 9 months ago

I, like [you](https://github.com/OliverBalfour/obsidian-pandoc/wiki/Citations-(work-in-progress), really want to have my Obsidian internal links / wikilinks AND markdown citations rolled into one :)

I've been fiddling about with an "emergency" project that grew into a plugin which overlaps a bit with this one, "https://github.com/jeetsukumaran/obsidian-impresario". The motivation behind that was primarily I wanted to build in the full compile instructions into the document YAML properties because I kept forgetting the way I mean the document to be compiled when revisiting it (e.g., slide level), and wanted an easier way to make sure all the filters/templates/javascript assets etc. would be bundled.

There is a Lua filter with that plugin:

https://github.com/jeetsukumaran/obsidian-impresario/blob/main/resources/publication/pandoc/filters/pdcites.lua

that works on wikilinks parsed when the "wikilinks_title_after_pipe" extension is specified, and takes the title string and wraps it up as a Pandoc citation.

The following:

---
bibliography: "+system/testing/pd-cites/p1.bib"
---

## Pandoc native

The following formats are native Pandoc:

[@shannon-1948-mathematical-theory] 
[@{shannon-1948-mathematical-theory}]

## Obsidian native

The following must work through the filter:

- [[@shannon-1948-mathematical-theory]]
- [[discovery/sources/references/s/@shannon-1948-mathematical-theory|@shannon-1948-mathematical-theory]]
- [[Untitled|@shannon-1948-mathematical-theory]]

Here, we have multiple citations, separated by semicolons [ [[discovery/sources/references/s/@shannon-1948-mathematical-theory|@shannon-1948-mathematical-theory]];
[[discovery/sources/references/m/@morlon-2014-phylogenetic-approaches|@morlon-2014-phylogenetic-approaches]];
[[discovery/sources/references/k/@kingman-1982-coalescent|@kingman-1982-coalescent]] 
].

## Explicit vs. implicit citation based on title

- [[discovery/sources/references/k/@kingman-1982-coalescent|@kingman-1982-coalescent]]
- [[discovery/sources/references/s/@shannon-1948-mathematical-theory|@shannon-1948-mathematical-theory]]
- [[discovery/sources/references/k/@kingman-1982-coalescent]]
- [[discovery/sources/references/s/@shannon-1948-mathematical-theory]]

results in:

image

jeetsukumaran commented 9 months ago

Hi @universvm and @mokeyish -- we have had this ^ discussion before. Tagging you here in case you might be interested in adopting as well.

devinat1 commented 9 months ago

Writing here to express interest in this solution. It would be really great to have the citations and links rolled into one!