Skip to content

Commit 909a575

Browse files
FIX: correct font-sizes (again!) (#237)
* chore: fix font sizes * chore: simplify preflight * chore: run linter * Update Playwright Snapshots * fix: add proof styles * chore: update ui-tests * chore: run prettier * test: update test * Update Playwright Snapshots --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 518dc9a commit 909a575

20 files changed

+427
-129
lines changed

src/myst.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ export async function processArticleMDAST(
9999

100100
const { frontmatter: frontmatterRaw } = getFrontmatter(file, mdast);
101101
// unnestKernelSpec(rawPageFrontmatter);
102-
console.log(JSON.stringify(frontmatterRaw));
103102
const frontmatter = validatePageFrontmatter(frontmatterRaw, {
104103
property: 'frontmatter',
105104
messages: {}

style/preflight.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55

66
/* This is a highly simplified version of https://tailwindcss.com/docs/preflight to work with JupyterLab */
77

8-
.myst {
9-
font-size: var(--jp-content-font-size1);
10-
color: var(--jp-content-font-color1);
11-
}
12-
138
.myst
149
:where(*):not(
1510
:where([class~='jp-RenderedHTMLCommon'], [class~='jp-RenderedHTMLCommon'] *)

style/tailwind.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
@import url('@myst-theme/styles/block-styles.css');
1111
@import url('@myst-theme/styles/tasklists.css');
1212
@import url('@myst-theme/styles/hover.css');
13+
@import url('@myst-theme/styles/proof.css');

tailwind.config.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ module.exports = {
2020
typography: theme => ({
2121
DEFAULT: {
2222
css: {
23+
fontSize: 'var(--jp-content-font-size1)',
24+
color: 'var(--jp-content-font-color1)',
25+
fontFamily: 'var(--jp-content-font-family)',
26+
lineHeight: 'var(--jp-content-line-height)',
2327
p: {
24-
color: 'var(--jp-content-font-color1)',
25-
fontFamily: 'var(--jp-content-font-family)',
26-
fontSize: 'var(--jp-content-font-size1)',
27-
lineHeight: 'var(--jp-content-line-height)',
2828
marginTop: 0,
2929
marginBottom: '1em'
3030
},
@@ -33,8 +33,7 @@ module.exports = {
3333
fontWeight: 'var(--jp-content-heading-font-weight, 500)',
3434
fontStyle: 'normal',
3535
marginTop: 'var(--jp-content-heading-margin-top, 1.2em)',
36-
marginBottom: 'var(--jp-content-heading-margin-bottom, 0.8em)',
37-
color: 'var(--jp-content-font-color1)'
36+
marginBottom: 'var(--jp-content-heading-margin-bottom, 0.8em)'
3837
},
3938
'h1:first-child,h2:first-child,h3:first-child,h4:first-child,h5:first-child,h6:first-child':
4039
{

ui-tests/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
},
1111
"devDependencies": {
1212
"@jupyterlab/galata": "^5.0.5",
13-
"@playwright/test": "^1.37.0"
13+
"@playwright/test": "^1.37.0",
14+
"glob": "^10.3.12"
1415
}
1516
}

ui-tests/tests/files-run.spec.ts

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,34 @@
33

44
import { expect, galata, test } from '@jupyterlab/galata';
55
import * as path from 'path';
6+
import { globSync } from 'glob';
67

7-
const fileName = 'myst_tests.md';
88
const FACTORY = 'Markdown Preview';
99
// test.use({ tmpPath: 'notebook-run-test' });
1010

11-
test.describe.serial('File Run', () => {
12-
test.beforeEach(async ({ request, page, tmpPath }) => {
13-
const contents = galata.newContentsHelper(request, page);
14-
await contents.uploadFile(
15-
path.resolve(__dirname, `./files/${fileName}`),
16-
`${tmpPath}/${fileName}`
17-
);
18-
});
11+
const files = globSync('files/*.md', { cwd: __dirname });
12+
13+
for (const file of files) {
14+
const fileName = path.basename(file);
15+
test.describe.serial(`File Run: ${file}`, () => {
16+
test.beforeEach(async ({ request, page, tmpPath }) => {
17+
const contents = galata.newContentsHelper(request, page);
18+
await contents.uploadFile(
19+
path.resolve(__dirname, file),
20+
`${tmpPath}/${fileName}`
21+
);
22+
});
1923

20-
test('View Markdown file and render result', async ({ page, tmpPath }) => {
21-
const filePath = `${tmpPath}/${fileName}`;
22-
await page.filebrowser.open(filePath, FACTORY);
24+
test('View Markdown file and render result', async ({ page, tmpPath }) => {
25+
const filePath = `${tmpPath}/${fileName}`;
26+
await page.filebrowser.open(filePath, FACTORY);
2327

24-
const name = path.basename(filePath);
25-
await page.activity.getTab(name);
28+
const name = path.basename(filePath);
29+
await page.activity.getTab(name);
2630

27-
const panel = await page.activity.getPanel(name);
31+
const panel = await page.activity.getPanel(name);
2832

29-
expect(await panel!.screenshot()).toMatchSnapshot();
33+
expect(await panel!.screenshot()).toMatchSnapshot();
34+
});
3035
});
31-
});
36+
}
-148 Bytes
Loading
36 KB
Loading
24 KB
Loading

ui-tests/tests/files/directives.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Directives
3+
date: 2024-04-26
4+
authors:
5+
- name: Angus Hollands
6+
affiliations:
7+
- 2i2c
8+
---
9+
10+
```{note}
11+
:class: dropdown
12+
13+
This is MyST in a notebook rendered by `jupyterlab-myst`!!
14+
```
15+
16+
:::{pull-quote}
17+
We know what we are, but know not what we may be.
18+
:::
19+
20+
They say the owl was a baker’s daughter. Lord, we know what we are, but know not what we may be. God be at your table.
21+
22+
:::{prf:proof}
23+
:label: full-proof
24+
Let $z$ be any other point in $S$ and use the fact that $S$ is a linear subspace to deduce
25+
26+
```{math}
27+
\| y - z \|^2
28+
= \| (y - \hat y) + (\hat y - z) \|^2
29+
= \| y - \hat y \|^2 + \| \hat y - z \|^2
30+
```
31+
32+
Hence $\| y - z \| \geq \| y - \hat y \|$, which completes the proof.
33+
:::
34+
35+
```{mermaid}
36+
flowchart LR
37+
A[Jupyter Notebook] --> C
38+
B[MyST Markdown] --> C
39+
C(mystmd) --> D{AST}
40+
D <--> E[LaTeX]
41+
E --> F[PDF]
42+
D --> G[Word]
43+
D --> H[React]
44+
D --> I[HTML]
45+
D <--> J[JATS]
46+
```

0 commit comments

Comments
 (0)