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

:literalref: should be able to work like :ref: #47

Open
lengau opened this issue Jan 18, 2025 · 4 comments
Open

:literalref: should be able to work like :ref: #47

lengau opened this issue Jan 18, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@lengau
Copy link

lengau commented Jan 18, 2025

Currently using literalref is a bit unintuitive, as it can only work like standard reStructuredText links. It should also be able to reference labels like :ref:.

@SecondSkoll
Copy link
Collaborator

literalref is only intended for use with HTML links, as it prevents the spellcheck from parsing the link text. What's the use case for internal references?

literalref - Renders the provided reference in code-style, which excludes the link text from the spelling checker. You can provide either just the link (for example, :literalref:www.example.com , which results in www.example.com as the link text and https://www.example.com as the link URL) or a separate link text and URL (for example, :literalref:xyzcommand <www.example.com> ).

@lengau
Copy link
Author

lengau commented Jan 18, 2025

We have a lot of cases where we want to link to a reference that refers to a YAML key, a filename, a charmcraft command, etc., that should be treated as literals as well. A nice example of the first three listed is at https://canonical-charmcraft.readthedocs-hosted.com/en/stable/reference/files/charmcraft-yaml-file/:

  1. charmcraft init should be both a literal and a link to the command.
  2. The link to actions.yaml should be the same.
  3. Some sections have cross-references to other sections within the file that are YAML key sections.

@SecondSkoll SecondSkoll added the enhancement New feature or request label Jan 20, 2025
@SecondSkoll
Copy link
Collaborator

I see, that's fair. I'm not sure when we'll be able to give this the attention it deserves, but for the moment, the combo-roles extension can be used to combine the code and ref roles. I've verified it works.

@medubelko
Copy link

medubelko commented Jan 21, 2025

The combo-roles site is down for me. The repo is here: https://github.com/sphinx-notes/comboroles

medubelko added a commit to medubelko/starbase that referenced this issue Jan 24, 2025
Resolve erroneous link warnings affecting literalref directives. Sphinx-lint
will no longer check for spaces before angle brackets (` <>`) or underscores
after graves (`_).

The root cause is a bug in our implementation of literalref:
canonical/canonical-sphinx-extensions#47
lengau pushed a commit to canonical/starbase that referenced this issue Jan 29, 2025
Resolve erroneous link warnings affecting literalref directives. Sphinx-lint
will no longer check for spaces before angle brackets (` <>`) or underscores
after graves (`_).

The root cause is a bug in our implementation of literalref:
canonical/canonical-sphinx-extensions#47
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

3 participants