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

Padding issues in highlighted code examples #144

Closed
cfa opened this issue Feb 26, 2023 · 5 comments
Closed

Padding issues in highlighted code examples #144

cfa opened this issue Feb 26, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@cfa
Copy link
Contributor

cfa commented Feb 26, 2023

Tokens in certain highlighted code blocks are incorrectly spaced due to additional horizontal padding provided by the stylesheet.

There are multiple instances of the problem on the Regexes page; a representative example is the spacing around :nth, :1st, etc. under the positional adverb heading.

The cause appears to be the section class in the main stylesheet1

.section {
  padding: 3rem 3rem;
}

which pads spans like the following

<span class="entity name section adverb regexp paren raku"><span>:nth</span></span>

Footnotes

  1. For screen; there's also a fallback to 1.5rem in main.css.

@finanalyst
Copy link
Collaborator

Code examples may not be the only styling problem.
Styling comes from several sources: the bulma CSS framework, adaptations for this website, which has separate stylesheets for code and ambient text, adaptations for plugin add ons

@finanalyst finanalyst added this to the 2023-Quarter 2 milestone Feb 26, 2023
@coke
Copy link
Contributor

coke commented Feb 27, 2023

Following up from an IRC discussion, it is not just padding around the examples, but inside the example itself.

$_ = 'The cat chases the dog';
s:global:samecase[the] = 'a';
say $_;                 # OUTPUT: «A cat chases a dog» 

is the raw source, but the s: here has much more horizontal whitespace inside the example itself; that is, the extra padding isn't just around the example.

@raiph
Copy link

raiph commented Feb 27, 2023

Example:

https://docs.raku.org/language/regexes.html#Samecase

image

@coke
Copy link
Contributor

coke commented Feb 27, 2023

@raiph++ - the issue is the extra horizontal space on (e.g.) the second line between the s and the :

@coke coke added the bug Something isn't working label Feb 27, 2023
cfa added a commit to cfa/doc-website that referenced this issue Feb 27, 2023
`.section` class padding currently interferes with the rendering of examples
(see Raku#144).  Explicitly set it to `0rem` within code blocks.
cfa added a commit to cfa/doc-website that referenced this issue Feb 27, 2023
`.section` class padding currently interferes with the rendering of examples
(see Raku#144).  Explicitly set it to `0rem` within code blocks.

The actual update is to `_highlighting.scss`; CSS files were regenerated by
the `update-css` script.
cfa added a commit to cfa/doc-website that referenced this issue Feb 27, 2023
`.section` class padding currently interferes with the rendering of examples
(see Raku#144).  Explicitly set it to `0rem` within code blocks.

The actual update is to `_highlighting.scss`; CSS files were regenerated by
the `update-css` script.
finanalyst pushed a commit that referenced this issue Feb 27, 2023
* Override CSS padding in `.raku-code` divs

`.section` class padding currently interferes with the rendering of examples
(see #144).  Explicitly set it to `0rem` within code blocks.

The actual update is to `_highlighting.scss`; CSS files were regenerated by
the `update-css` script.

* Remove sourceMappingURLs
@finanalyst
Copy link
Collaborator

Closing issue as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants