JuliaPluto / PlutoTeachingTools.jl

Functions useful when using Pluto in teaching.
https://juliapluto.github.io/PlutoTeachingTools.jl/example.html
MIT License
59 stars 14 forks source link

Interpolation in footnotes #57

Open ReubenJ opened 16 hours ago

ReubenJ commented 16 hours ago

Use case: I'd like to combine footnotes from this package with ShortCodes.jl'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, 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, and something would need to change there.

eford commented 14 hours ago

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 https://github.com/JuliaPluto/PlutoUI.jl/issues/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 https://github.com/JuliaPluto/PlutoTeachingTools.jl/issues/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

mossr commented 8 hours ago

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(...))
""")