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

Can't use anything for a button-link URL other than a string? #222

Open
matterhorn103 opened this issue Sep 10, 2024 · 0 comments
Open

Can't use anything for a button-link URL other than a string? #222

matterhorn103 opened this issue Sep 10, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@matterhorn103
Copy link

matterhorn103 commented Sep 10, 2024

Context

Hi!

We're using Sphinx/MyST-Parser/MyST Markdown/Sphinx-Design. Sphinx-Design is really nice and has made creating an adaptable web layout very easy, so thanks.

We have one problem though. Various external URLs used on our site need to automatically adapt to the current release version being changed in conf.py.

Across the site this is in general done using myst_substitutions to insert the appropriate URL, and the URLs are defined using f-strings in conf.py so that the up-to-date URLs are generated at build time. This works fine in most places, up until wanting to use it in some Sphinx-Design buttons that I am trying to make.

Previously a particular set of link buttons were created within a Sphinx-Design card like so:

{{ '<a class="sd-sphinx-override sd-btn sd-text-wrap sd-btn-outline-primary reference external" href="' + winurl + '"><span>Download Installer</span></a>'}}

The resulting link works fine but the created button has awkward formatting and looks out of place next to the native Sphinx-Design ones, so I tried to turn them into proper SD buttons:

:::{button-link} {{winurl}}
:color: primary
:outline:
Download Installer
:::

but the substitution doesn't work.

I've scoured the web and tried myst_url_schemes as well as what feels like every possible syntax and nothing works. Why don't any of the syntaxes with ', {, <, ", ``, do anything other than pass the literal characters in this situation? Is there any way to give a URL argument to the {button-link} directive as anything other than a simple string?

Any help appreciated.

Proposal

No response

Tasks and updates

No response

@matterhorn103 matterhorn103 added the enhancement New feature or request label Sep 10, 2024
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

No branches or pull requests

1 participant