Use existing .docx (with citations) in a markdown app
Hello, I have recently started using Ulysses for writing and now I'd like to use it for my research. I have come across some useful tips and tools about using Ulysses with Zotero. The workflow is something like this: 1) write in Ulysses; 2) insert citations with BetterBibTex and the zot-pick script; 3) export into .docx with pandoc and citeproc.
I still have many of my drafts in MS-Word. I am trying to find a workaround for importing my MS-Word files into Ulysses Markdown BUT keeping the citations already typed in... I was thinking of probably transforming the already existing citations into the citation-keys brackets format that works in Markdown (v.g., [@authoryear]). But I am not sure about how to make this happen for all of my citations. The only thing that comes to my mind is to manually re-insert every citation-key in Ulysses. Does something come to your mind to achieve this workflow?
Josh
I still have many of my drafts in MS-Word. I am trying to find a workaround for importing my MS-Word files into Ulysses Markdown BUT keeping the citations already typed in... I was thinking of probably transforming the already existing citations into the citation-keys brackets format that works in Markdown (v.g., [@authoryear]). But I am not sure about how to make this happen for all of my citations. The only thing that comes to my mind is to manually re-insert every citation-key in Ulysses. Does something come to your mind to achieve this workflow?
Josh
It is in principle possible to create a reverse filter that takes Zotero-citations in a word file and produce a markdown file with equivalent citation markers, it's just a lot harder, since in going from markdown -> word, pandoc marks the citations clearly and they're almost trivial to pick out and replace. Going the other way, not only are zotero-citations not clearly marked (as far as pandoc is concerned, it's just text), the important bits that make it recognizable (the zotero bookmark/fields the citations live in) do not make it into the AST. So I'd have to get chunks of text and inspect the raw XML and replace the proper bits of it and nothing else, keeping the XML structure intact, before the rest of the pandoc pipeline gets to it. I'm not even sure this is possible. I might have to resort to python, which is a shame, because that's harder for most users to install.
https://gist.github.com/alanzchen/6c30227d82f411da1baba4b7d1ec088b
You will need to first save your word file: https://www.zotero.org/support/kb/moving_documents_between_word_processors
Then use pandoc to convert it to markdown:
`pandoc example.docx --wrap=none -o example.md`
Finally use my script:
`./convert.py /Users/alan/Zotero/better-bibtex-search.sqlite example.md`
Feel free to try it out!