Open synergico opened 7 years ago
if Typora could do this, it would be a New Emacs, at lest, a new org-mode.
On Sat, Sep 16, 2017 at 8:20 PM, synergico notifications@github.com wrote:
Hi, I know this is kinda far fetching, but I think it could be awesome if Typora supports referencing by using something like '@' to mention a source, by connecting to something like Endnote, Zotero or BibRef? It could win a lot of customer like student or researcher Just planting an idea here :), cause I enjoy writing with Typora everyday. Cheers, Tri
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/typora/typora-issues/issues/912, or mute the thread https://github.com/notifications/unsubscribe-auth/AegYqkYl_LpT590rK37xlJ0RxnHx-b6Uks5si70jgaJpZM4PZzWK .
related: #66
I'd love this feature as well! I really like writing in markdown, but writing scientific papers is still a pain and requires a lot of fiddling around. If you could somehow nail this with typora, I'd be willing to throw a lot of money in your direction! 😄 I'm looking for a markdown editor that can do this for quite a while.
By support, it means
Is there any other kind of support I missed?
Op of #66 here, I think you have it covered
@azag0 Pardon my noob-ness, how do I start referencing? Would you point me to a quick tutorial? Thank you very much! Is it possible to use it with Zotero?
@abnerlee Adding my name to this request -- for me, I'm particularly looking for pandoc-citeproc support (and relatedly, I'd also love to be able to use pandoc to export to LaTeX PDF directly from within Typora).
@abnerlee In addition to syntax-highlighting and auto-completion, one would also want to have the references correctly displayed in exported HTML and PDF.
So one could add to the list:
if Typora supports referencing by using something like '@' to mention a source, by connecting to something like Endnote, Zotero or BibRef
How about referencing from a bibtex file? Most reference managers can export the library that way.
An example how it works in Scrivener with pandoc, a reference style (CSL file) and an bibtex (my.bib) export out of Bookends as the reference manager: https://github.com/iandol/scrivomatic https://www.rousette.org.uk/archives/bookends-and-pandoc/
If I choose Typora, and I would love to, writing a thesis, it is necessary to have direct support. Else I need to export my research paper out of Typora to Word and use Bookends in Word parsing the citation entries. It is an option, but increases the time I need for my adacemic workflow.
We still need official support for this; I suggest that Typora looks for a .bib file in the same directory af the current .md file as default, and custom path .bib files to be added in the YAML header.
However until we (hopefully) get this, here is a workaround for Mac and Alfred users:
Btw if one uses pandoc to convert instead of just exporting from within Typora, you can choose a csl file using in the header e.g. csl: "chicago-author-date.csl"
where in this case the csl file is in the same folder.
This would be great! Love using Typora, but i just got some flak for not referencing properly. Might write a simple regex-script to do this myself, but would definitely prefer something integrated.
You can use Pandoc to convert your Markdown file with citations to a LaTeX, PDF or Markdown where your citation markup is replaced by citations and a list of references in a style defined in a csl-file. Raphael Kabo covers that approach in detail at his blog.
What I would like to see is live rendering support for Markdown citations in Typora's preview mode. It works in Atom Editor with Markdown Preview Plus and pandoc as render backend enabled.
I think a simple-to-implement and helpful first step would be if Typora would support pandoc's --bibliography
argument. For instance, pandoc --bibliography references.bib myfile.md -o myfile.docx
would convert a markdown into a Word file using and converting the references in the .bib
file.
So there could be new options for exporting in Typora: Export > Word (with references)
and Export > PDF (with references)
Note: this refers to the issue of syntax highlighting (#294), but as this issue is closed, posted it here as well. I got the highlighting working by inserting some javascript in the console. Steps to replicate:
First: Create a file named base.user.css
in /Users/username/Library/Application Support/abnerworks.Typora/themes/
, and add the following code [with the highlight color of your choice]:
.blue {
color: #005ce6
}
Typora
-> Preference...
-> Security
-> check Enable Debug
Help
-> Enable Debugging
Inspect Element
console
tab and insert the following code: $(document).ready(function(){
$("#write").html(function(_, html){
return html.replace(/(\@\w\S+)/g, '<span class="blue">$1</span>');
});
});
This should give something like this (with Night theme enabled):
A live version of the code can be found here http://jsfiddle.net/drckx/z3e10bwa/ [based on css-tricks post]
Now, some more practical questions, does anybody know how to:
@reference
items also get coloured?/(\@\w\S+)/g
so that trailing points or brackets don't get coloured?
@author_title_YEAR
it seems to work with /(\@\w\S+\d\d\d\d)/g
One step further in getting forward with point 1. :
It seems that injecting a script after line 218
in index.html
does the trick of colouring the references when opening Typora, but it messes some lists up (depending on the location, before or after line 219, also MathJax) and it seems writing gets altered as well [shifting pointer, etc..]
To reproduce:
/Applications/Typora.app/Contents/Resources/TypeMark/app/colour.js
:Fill in with:
$(document).ready(function(){ $("#write").html(function(_, html){ return html.replace(/(\@\w\S+\d\d\d\d)/g, '<span class="blue">$1</span>'); }); });
index.html
file in /Applications/Typora.app/Contents/Resources/TypeMark
:Add the following on line 220:
<script src="./app/colour.js" aria-hidden="true" defer></script>
Update on syntax highlighting: I managed to get live syntax highlighting for references in the format [@citekey; @citekey; ...] or [@citekey] working. It is not yet able to differentiate @citekeys that are written without square brackets. If you have any idea how to solve this, please give a shout!
How to:
Typora.app/Contents/Resources/Typemark/app/main.js
(after reformat of code and afterwards using uglyfyjs to minify):
Typora.app/Contents/Resources/Typemark/style/base.css
.md-citation {
color: #53c3fc;
opacity: .8;
font-family: monospace;
font-family: var(--monospace)
}
This should render the following (also while typing):
As you can see it is not yet ideal, but at least the citekeys in square brackets get recognised, also when there are multiple citekeys between the brackets. I tried a bunch of other regex expressions, but none was able to capture the @citekeys without brackets. For a list of regex codes I tried, see this gist. If somebody has any clue on how to optimise the regex expressions (both of citation
and ut.citation_ex
), give a shout and/or tryout and let me/us know!
@floriandierickx Which Markdown spec is using syntax [@citekey]
for references?
It is Pandoc markdown citations, processed by pandoc-citeproc. A lot of researchers use this markdown-flavor to convert research documents [in Pandoc markdown or RMarkdown - from what I know they are basically the same, except that RMarkdown allows integration of R-code inside and is specifically tailored to be used in RStudio] to doc(x), latex or pdf. My setup (and I guess a lot of others) is using Zotero from @dstillman and co. for citations, Zotero BetterBibTex from @retorquere to maintain a clean .bib
file, and markdown and pandoc to convert to pdf or other formats. A more 'latex-hardcore' alternative could be to use JabRef for citation management (in which case you don't need Zotero BetterBibTex), but the rest of the workstream setup would be the same I guess. They (Zotero, BetterBibtex, JabRef, markdown, pandoc) are all solid and very lively and well-maintained open source projects, used by a lot of researchers. I had already quite some fruitful exchanges with @retorquere on the development of Zotero BetterBibTex, and he helped me (and others) a lot to all have a nicely working research setup.
What your project is bringing to all this (I am currently using Atom with some tweaks to write), is that it would be much more pleasant to work and look at the text, so I hope you're considering integrating - to start with - citation syntax highlighting! And as @nheeren mentioned, another not-too-difficult implementation could be to integrate Pandoc in the features to convert markdown to other formats.
A little note: apart from citation formats such as [@citekey]
, [@citekey1; @citekey2]
, [see @citekey1, pp. 33-35; also @citekey2, chap. 1]
, [-@citekey]
, ... , also the usage of @citekey
is used to integrate an in-text citation that will render as "...which has been proven by Steffen et al. (2012) and...". For this I didn't find a suitable working regex expression yet, and the regex that I implemented now is specifically tailored to citations in the format @lowcasetext_lowcasetext_*four digits*
, as I have set it up like that in BetterBibTex. A better regex would be one that includes anything after the @
until there is a .
, `,
;,
?or another character that can be expected after a word or citation in a text, or - for the
[@citekey, .....]variant - something to capture anything between
[@and
]`.
While BBT primarily does BibTeX (which is unsurprising given its name), it also generates pandoc-friendly csl-json and csl-yaml, and provides an integration point for editors that want to provide cite as you write. The latter allows searching in Zotero via a simple HTTP API and outputs to the caller information about the reference -- currently various ways to decorate the citation key, but also fully rendered citations/bibliography entries, others (and more can be added if there's a good use-case)
Anyone still waiting for citation support in Typora might want to check out the open source markdown editor Zettlr: https://www.zettlr.com/.
I tried to use Zettlr, but its just so heavy on the eyes.
Any updates on this?
I tried to use Zettlr, but its just so heavy on the eyes.
Agreed... the writing experience isn't as polished as typora.
Any update on the addition of bibliography support?
It seems supporting citation is similar to supporting Latex equations - that is how Zettlr does it.
It seems supporting citation is similar to supporting Latex equations - that is how Zettlr does it.
You mean, that's a "short-cut" to make it work, or are you proposing an implementation for the developer?
Why not add support for syntax like Pandoc does? You could specify the path to the .bib
file somewhere, maybe in the YAML header, and then in the text simply cite as [@2020AuthorShorttitle;@2019Author2Shorttitle2]
, the key recognition syntax being "[@
". This way it would still be compatible with pandoc
and would still allow for those workflows without changing anything.
Would love that feature as well! For example, like @leowill01 proposed above. This way it would also match the way you use academic citation in an editor like VS Code or Sublime.
any updates on this one ?
Adding to @leowill01 suggestion, maybe there could be a block similar to [toc] that all the references get automatically added to.
This way you could have a .bib
file with all your metatdata and when you actually cite something, the metadata gets read from the .bib
file and added to the references-block.
For syntax maybe something along the line of [ref]
or [bib]
.
As for specifying the path of the .bib
file, maybe there could be a global option in the preferences that can be overwritten via the YAML-Header.
Maybe one could also specify the citation style in the preferences with simple syntax using variables: "${id} ${title} ${author} ..."
Basically the variables that are used within the bibtex format.
I'd really like to see this happen. It would make writing academic papers so much easier and Typora even more awesome!
A little note: apart from citation formats such as
[@citekey]
,[@citekey1; @citekey2]
,[see @citekey1, pp. 33-35; also @citekey2, chap. 1]
,[-@citekey]
, ... , also the usage of@citekey
is used to integrate an in-text citation that will render as "...which has been proven by Steffen et al. (2012) and...". For this I didn't find a suitable working regex expression yet, and the regex that I implemented now is specifically tailored to citations in the format@lowcasetext_lowcasetext_*four digits*
, as I have set it up like that in BetterBibTex. A better regex would be one that includes anything after the@
until there is a.
,`,
;,
?or another character that can be expected after a word or citation in a text, or - for the
[@citekey, .....]variant - something to capture anything between
[@and
]`.
Hi. I have noticed that if you change line:
text: /^(\s|\S)+?[^\n\t\u200B\uE010-\uE020\uE006\uE023\uE031\\<!\[._*`&{\$\:~\^\="'\-]*/,
to
text: /^(\s|\S)+?[^\n\t\u200B\uE010-\uE020\uE006\uE023\uE031\\<!\[._*`&{\$\:~\^\="'\-@]*/,
Then in citations without brackets also work. It seems to be responsible for splitting the text into parseable blocks.
any updates?
Would love to see proper citations and citation-autocompletion, as mentioned above.
Still in need of this feature ^
I hope it will support this feature in future
please, still needed
While BBT primarily does BibTeX (which is unsurprising given its name), it also generates pandoc-friendly csl-json and csl-yaml, and provides an integration point for editors that want to provide cite as you write. The latter allows searching in Zotero via a simple HTTP API and outputs to the caller information about the reference -- currently various ways to decorate the citation key, but also fully rendered citations/bibliography entries, others (and more can be added if there's a good use-case)
By any chance do you or anyone knows if someone already made a cite as you write script in windows for Typora ? Something like a zotero picker that could work in Typora ? Thanks in advance.
I am also very interested in a bibtex integration. As @eriksdev1 already mentioned there is already a usable API Endpoint that could be integrated into Typora.
Interested in it. At least provide some support for render bibtex items?
Hi, I know this is kinda far fetching, but I think it could be awesome if Typora supports referencing by using something like '@' to mention a source, by connecting to something like Endnote, Zotero or BibRef? It could win a lot of customers like student or researcher Just planting an idea here :), cause I enjoy writing with Typora everyday. Cheers, Tri