docs: fix line breaks when copying commands from website#483
Open
Git-HimanshuRathi wants to merge 1 commit intourunc-dev:mainfrom
Open
docs: fix line breaks when copying commands from website#483Git-HimanshuRathi wants to merge 1 commit intourunc-dev:mainfrom
Git-HimanshuRathi wants to merge 1 commit intourunc-dev:mainfrom
Conversation
The MkDocs Material theme's CSS rule for .md-code__content applies display: block to all child span elements, including token-level spans (keywords, whitespace, variables) and hidden anchor tags. This causes browsers to insert line breaks between these elements when users copy code snippets from the documentation. Add CSS overrides scoped to .md-code__content to force token-level spans and anchor tags inside line spans to display: inline, fixing the copy behavior. Fixes: urunc-dev#482 Signed-off-by: Git-HimanshuRathi <himanshurathiwork@gmail.com>
✅ Deploy Preview for urunc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Author
|
@cmainas can u allow workflow to run ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The MkDocs Material theme's CSS rule for .md-code__content applies display: block to all child span elements, including token-level spans (keywords, whitespace, variables) and hidden anchor tags. This causes browsers to insert line breaks between these elements when users copy code snippets from the documentation.
Add CSS overrides scoped to .md-code__content to force token-level spans and anchor tags inside line spans to display: inline, fixing the copy behavior.
Fixes: #482
Description
This change fixes an issue where copying commands from the documentation resulted in unwanted line breaks (e.g.,
wget\n -qinstead ofwget -q).The root cause was a broad CSS rule in the MkDocs Material theme that sets
display: blockon all spans inside.md-code__content. This PR adds scopedCSS overrides so that only line-level spans remain block elements, while
token-level spans and anchor tags render inline. This preserves syntax
highlighting and layout while ensuring correct copy behavior.
How was this tested?
Tested locally by running the MkDocs development server and navigating to the
installation guide. Verified that copying commands using both manual text
selection and the copy button preserves correct formatting without unwanted
line breaks.
Before fix (copied text):
After fix (copied text):
LLM usage
N/A
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).