Skip to content
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

Multiple citations per link with "collapsed" rendering #6

Closed
goerz opened this issue Jul 11, 2023 · 0 comments · Fixed by #43
Closed

Multiple citations per link with "collapsed" rendering #6

goerz opened this issue Jul 11, 2023 · 0 comments · Fixed by #43
Labels
enhancement New feature or request

Comments

@goerz
Copy link
Member

goerz commented Jul 11, 2023

I'd prefer to write Quantum optimal control [BrumerShapiro2003](@cite)[BrifNJP2010](@cite)[Shapiro2012](@cite)[KochJPCM2016](@cite)[SolaAAMOP2018](@cite)[MorzhinRMS2019](@cite)[Wilhelm2003.10132](@cite)[KochEPJQT2022](@cite), which currently renders as "Quantum optimal control [1][2][3][4][5][6][7][8]", as the shorter
Quantum optimal control [BrumerShapiro2003, BrifNJP2010, Shapiro2012, KochJPCM2016, SolaAAMOP2018, MorzhinRMS2019, Wilhelm2003.10132, KochEPJQT2022](@cite) and have it render as the collapsed "Quantum optimal control [1-8]". Note that the rendered text has two separate links.

Parsing the citation syntax with multiple keys is already supported in the current master of DocumenterCitations:

julia> using DocumenterCitations: CitationLink

julia> using Markdown

julia> function _link(text::String)
           md = Markdown.parse(text)
           return md.content[1].content[1]
       end

julia> cit = CitationLink(_link("[BrumerShapiro2003, BrifNJP2010, Shapiro2012, KochJPCM2016, SolaAAMOP2018, MorzhinRMS2019, Wilhelm2003.10132, KochEPJQT2022](@cite)"))
CitationLink(
    link=Markdown.Link(Any["BrumerShapiro2003, BrifNJP2010, Shapiro2012, KochJPCM2016, SolaAAMOP2018, MorzhinRMS2019, Wilhelm2003.10132, KochEPJQT2022"], "@cite"),
    cmd=cite,
    style=nothing,
    keys=["BrumerShapiro2003", "BrifNJP2010", "Shapiro2012", "KochJPCM2016", "SolaAAMOP2018", "MorzhinRMS2019", "Wilhelm2003.10132", "KochEPJQT2022"],
    note=nothing,
    capitalize=false,
    starred=false,
    link_text=nothing
)

However, the feature is currently undocumented, since there is no (or at least no straightforward way) to render it with Documenter 0.27: right now, the format_citation function only modifies the link text of the citation link, but it doesn't break out of the structure of the single markdown link.

With the master version of Documenter, it should be possible to extend this: The format_citation for the above CitationLink should return an entire markdown snippet with multiple links, and that markdown snippet should then be parsed internally and inserted into the output tree.

How collapsed rendering would look with author-year styles is still to be determined. I'd mimic whatever RevTeX does as closely as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant