-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interpolation in footnotes #57
Comments
That seems like a nice feature suggestion. Unfortunately, I'm not
competent at JavaScript. I'd suggest that we ask some of the folks who
contributed to [
JuliaPluto/PlutoUI.jl#44](PlutoUI#44) if they
might be interested in helping here.
@shashi, @dralletje, @mossr, @fonsp
…On Mon, Sep 23, 2024 at 8:40 AM Reuben Gardos Reid ***@***.***> wrote:
Use case: I'd like to combine footnotes from this package with
ShortCodes.jl <https://github.com/hellemo/ShortCodes.jl/tree/main>'s DOI
to do something like:
md"""As discussed in [^article], we want to do something."""
and further down the document:
md"""[^article]: $DOI(...)"""
Resulting in something like
As discussed in [1], we want to do something.
*[1]*
Buettner, Florian; Diamanti, Evangelia; Fisher, Jasmin; Göttgens,
Berthold; Haghverdi, Laleh; Jawaid, Wajid; Kouskoff, Valerie; Lilly, Andrew
J; Macaulay, Iain; Moignard, Victoria; Nishikawa, Shin-Ichi; Piterman, Nir;
Tanaka, Yosuke; Theis, Fabian; Wilkinson, Adam C; Woodhouse, Steven *Decoding
The Regulatory Network Of Early Blood Development From Single-Cell Gene
Expression Measurements*, Nature Biotechnology (2015) 10/f64rrc
<https://doi.org/10/f64rrc>, cited by 337
It currently doesn't interpolate the DOI object (or any expression within
the text) and looks something like this:
As discussed in [1], we want to do something.
[1]
DOI("10.1038/nbt.3154")
I guess it has something to do with the way the inner text is just taken
verbatim here
<https://github.com/JuliaPluto/PlutoTeachingTools.jl/blob/ca8cca84e7e0a96eee45ddd193f1b93072c29429/src/footnotes.jl#L17C11-L17C34>,
and something would need to change there.
—
Reply to this email directly, view it on GitHub
<#57>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKDFQRCU52VT37GDSNLIELZYAD2RAVCNFSM6AAAAABOV7T23OVHI2DSMVQWIX3LMV43ASLTON2WKOZSGU2DENJQHA4TSNA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Eric Ford
|
Just as trying to interpolate variables in any other Markdown block (regardless of the footnote or not), you'll have to do the following: Markdown.parse("""
[^article]: $(DOI(...))
""") |
Hmm, I don't think that's true. If you do the following: md"""
$(1+1)
""" It interpolates it correctly and it displays 2. If I use Markdown.parse("""
[^article]: $(DOI("10.1038/nbt.3154"))
""") ⬇️
I guess I could capture the output of |
Or, our recommendation, use @markdown """
[^article]: $(DOI("10.1038/nbt.3154"))
""" |
I got MarkdownLiteral.@markdown """
[^article]: $(DOI("10.1038/nbt.3154"))
""" did work for me. Or |
Yes that is correct |
@ReubenJ if that works for you, then would you like to add this to the example notebooks, so others can easily see how to use this pattern? |
Sure, I've updated the example to include this (see my fork, can open a PR if this is useful for others), but I don't understand why that's necessary when the interpolation seems to work just fine with Also, it doesn't matter much, but the end of the generated citation gets an extra line break before the DOI when using |
Thanks. I created a PR. |
I'm not sure why we are wondering about the difference in Markdown parsers, because for me the
Not sure if you are using a different Pluto setup, but for me all Even more so, because
I'm unsure if something changed, or I'm using a wrong Julia version or anything, but For some reason, the built-in markdown parser errors when doing You might notice how |
Sorry, I was replying to @ReubenJ's observation above that there was an extra new line in the footnote when using MarkdownLiteral. |
I think that's the answer. Personally, I prefer it shown inline. I'd suggest @ReubenJ create an issue for ShortCodes.jl to resolve this. |
It isn't, normal text is also shown on a separate line. |
@eford and I are referring to this newline: |
Ahaaaa, figured I was missing something! So yeah, this IS because of the markdown parser, the way Julia native [^article]: <div>Buettner, Florian; Diamanti, Evangelia; Fisher, Jasmin; Göttgens, Berthold; Haghverdi, Laleh; Jawaid, Wajid; Kouskoff, Valerie; Lilly, Andrew J; Macaulay, Iain; Moignard, Victoria; Nishikawa, Shin-Ichi; Piterman, Nir; Tanaka, Yosuke; Theis, Fabian; Wilkinson, Adam C; Woodhouse, Steven <em>Decoding The Regulatory Network Of Early Blood Development From Single-Cell Gene Expression Measurements</em>, Nature Biotechnology (2015)
<a href=https://doi.org/10/f64rrc>10/f64rrc</a>, cited by 337</div> And Commonmark panics! So it puts an extra Then, Pluto also does some odd styling itself around the footnotes... So where to create issues to fix this? So I think this falls on For now you can fix it with a little wrapper: # ╔═╡ 84d36bcf-cbf2-4ea7-9a94-b29f0dae512f
struct DOI2
cite
end
# ╔═╡ 0570067f-6376-443f-a595-29d5f0909d92
function Base.show(io::IO, ::MIME"text/html", x::DOI2)
text= repr("text/html", DOI(x.cite))
write(io, replace(text, "\n" => " ", "<div>" => "<p>", "</div>" => "</p>"))
end It's not pretty (in code)... but it works (We need the |
Thanks for diving in! If you think there's a chance If it becomes clear that's not a viable option, then I think we could have |
Hey all! So far we looked into fixing the problem that this syntax does not work: md"""
[^article]: $(DOI("asdfasdf"))
""" But for citations my dream would be to have functionality designed specifically for citation management, similar to how bibtex works. So you could do: md"""
This is great![^knuth]
""" And to show the list of used references, you just call a function that returns a pretty display of citations. list_references(bibtex=read("my_library.bibtex", String)) or list_references(
"knuth" => "https://doi.org/10.1038/nbt.3154",
"pluto" => "https://doi.org/10.5281/zenodo.4792401",
) |
Use case: I'd like to combine footnotes from this package with
ShortCodes.jl
'sDOI
to do something like:and further down the document:
Resulting in something like
It currently doesn't interpolate the
DOI
object (or any expression within the text) and looks something like this:I guess it has something to do with the way the inner text is just taken verbatim here, and something would need to change there.
The text was updated successfully, but these errors were encountered: