Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/resources/formats/html/bootstrap/_bootstrap-rules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2150,15 +2150,26 @@ code.sourceCode a.code-annotation-anchor {
// override _reboot.scss

// code blocks
pre code {
pre {
font-family: $font-family-monospace-block;
// I'm really not confident that this is correct
@include font-size($code-block-font-size);
font-weight: $font-weight-monospace-block;

// adding these inherit overrides here
// is what `_reboot.scss` does.
// we mirror it here for consistency
//
// Account for some code outputs that place code tags in pre tags
code {
font-family: inherit;
@include font-size(inherit);
font-weight: inherit;
}
}

// code inlines
p code {
code {
font-family: $font-family-monospace-inline;
@include font-size($code-inline-font-size);
font-weight: $font-weight-monospace-inline;
Expand Down
8 changes: 8 additions & 0 deletions tests/docs/playwright/html/code-font-size.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Testing code font size
format: html
---

```python
1 + 1
```
10 changes: 10 additions & 0 deletions tests/integration/playwright/tests/html-themes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,14 @@ test('Dark theming toggle change to dark background ', async ({ page }) => {
await page.locator("a.quarto-color-scheme-toggle").click();
const locatr2 = await page.locator('div').filter({ hasText: 'Quarto Playground' }).first()
await expect(locatr2).toHaveCSS('background-color', 'rgb(255, 0, 0)');
});

test('Code block font size did not change and still equals to pre size', async ({ page }) => {
await page.goto('./html/code-font-size.html');
const code = page.getByRole('code')
const pre = page.locator('pre')
const preFontSize = await pre.evaluate((element) =>
window.getComputedStyle(element).getPropertyValue('font-size'),
);
await expect(code).toHaveCSS('font-size', preFontSize);
});
Loading