Skip to content

Commit 38270d4

Browse files
authored
Merge branch 'executablebooks:main' into feat/myst-options
2 parents a305824 + b97920a commit 38270d4

File tree

12 files changed

+152
-61
lines changed

12 files changed

+152
-61
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = {
3232
'single',
3333
{ avoidEscape: true, allowTemplateLiterals: false }
3434
],
35-
eqeqeq: 'error',
35+
eqeqeq: 'off',
3636
'prefer-arrow-callback': 'error'
3737
}
3838
};

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,4 @@ jobs:
155155
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
156156
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
157157
with:
158-
ignore_links: "https:\/\/mybinder\.org.*"
158+
ignore_links: 'https:\/\/mybinder\.org.*'

CHANGELOG.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,33 @@
22

33
<!-- <START NEW CHANGELOG ENTRY> -->
44

5+
## 1.1.3
6+
7+
([Full Changelog](https://github.com/executablebooks/jupyterlab-myst/compare/v1.1.2...f105c803d0652d612012413a99d3ce82606ba311))
8+
9+
### Enhancements made
10+
11+
- ✅ Editable task lists [#121](https://github.com/executablebooks/jupyterlab-myst/pull/121) ([@rowanc1](https://github.com/rowanc1))
12+
- 🛩👩‍✈️💺 Remove almost all preflight css [#117](https://github.com/executablebooks/jupyterlab-myst/pull/117) ([@rowanc1](https://github.com/rowanc1))
13+
- 👩🏻‍🎨 Move to Jupyter-based styles [#116](https://github.com/executablebooks/jupyterlab-myst/pull/116) ([@rowanc1](https://github.com/rowanc1))
14+
15+
### Bugs fixed
16+
17+
- :police_officer: Executing Markdown cells should set trust [#119](https://github.com/executablebooks/jupyterlab-myst/pull/119) ([@agoose77](https://github.com/agoose77))
18+
19+
### Maintenance and upkeep improvements
20+
21+
- :camera: update integration snapshots [#122](https://github.com/executablebooks/jupyterlab-myst/pull/122) ([@agoose77](https://github.com/agoose77))
22+
- :link: Ignore Binder links in link-checker [#120](https://github.com/executablebooks/jupyterlab-myst/pull/120) ([@agoose77](https://github.com/agoose77))
23+
24+
### Contributors to this release
25+
26+
([GitHub contributors page for this release](https://github.com/executablebooks/jupyterlab-myst/graphs/contributors?from=2023-03-17&to=2023-03-22&type=c))
27+
28+
[@agoose77](https://github.com/search?q=repo%3Aexecutablebooks%2Fjupyterlab-myst+involves%3Aagoose77+updated%3A2023-03-17..2023-03-22&type=Issues) | [@github-actions](https://github.com/search?q=repo%3Aexecutablebooks%2Fjupyterlab-myst+involves%3Agithub-actions+updated%3A2023-03-17..2023-03-22&type=Issues) | [@rowanc1](https://github.com/search?q=repo%3Aexecutablebooks%2Fjupyterlab-myst+involves%3Arowanc1+updated%3A2023-03-17..2023-03-22&type=Issues)
29+
30+
<!-- <END NEW CHANGELOG ENTRY> -->
31+
532
## 1.1.2
633

734
([Full Changelog](https://github.com/executablebooks/jupyterlab-myst/compare/v1.1.1...9a85fa1753024ea6b293b92a250d91b437437242))
@@ -26,8 +53,6 @@
2653

2754
[@agoose77](https://github.com/search?q=repo%3Aexecutablebooks%2Fjupyterlab-myst+involves%3Aagoose77+updated%3A2023-02-27..2023-03-17&type=Issues) | [@github-actions](https://github.com/search?q=repo%3Aexecutablebooks%2Fjupyterlab-myst+involves%3Agithub-actions+updated%3A2023-02-27..2023-03-17&type=Issues) | [@rowanc1](https://github.com/search?q=repo%3Aexecutablebooks%2Fjupyterlab-myst+involves%3Arowanc1+updated%3A2023-02-27..2023-03-17&type=Issues)
2855

29-
<!-- <END NEW CHANGELOG ENTRY> -->
30-
3156
## 1.1.1
3257

3358
([Full Changelog](https://github.com/executablebooks/jupyterlab-myst/compare/v1.1.0...a942911c786d49b259759b8a9fd72b27e9253bc9))

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ Or with `matplotlib` to show inline spark-lines:
5959

6060
![](./images/stock-price.gif)
6161

62+
You can also edit tasklists directly in the rendered markdown.
63+
64+
![](./images/tasklists-in-jupyterlab.gif)
65+
6266
## Usage
6367

6468
[MyST][myst-quickstart] is a flavour of Markdown, which combines the fluid experience of writing Markdown with the programmable extensibility of reStructuredText. This extension for JupyterLab makes it easier to develop rich, computational narratives, technical documentation, and open scientific communication.

images/tasklists-in-jupyterlab.gif

622 KB
Loading

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jupyterlab-myst",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "Use MyST in JupyterLab",
55
"keywords": [
66
"jupyter",
@@ -61,25 +61,25 @@
6161
"@jupyterlab/notebook": "^3.5.1",
6262
"@jupyterlab/rendermime": "^3.5.1",
6363
"@jupyterlab/translation": "^3.5.1",
64-
"@myst-theme/diagrams": "^0.1.31",
65-
"@myst-theme/frontmatter": "^0.1.31",
66-
"@myst-theme/providers": "^0.1.31",
64+
"@myst-theme/diagrams": "^0.1.32",
65+
"@myst-theme/frontmatter": "^0.1.32",
66+
"@myst-theme/providers": "^0.1.32",
6767
"@types/markdown-it": "^12.2.3",
6868
"katex": "^0.15.2",
6969
"myst-ext-card": "^0.0.4",
7070
"myst-ext-grid": "^0.0.4",
7171
"myst-ext-tabs": "^0.0.4",
7272
"myst-frontmatter": "^0.0.9",
73-
"myst-parser": "^0.0.22",
74-
"myst-to-react": "^0.1.31",
75-
"myst-transforms": "^0.0.22"
73+
"myst-parser": "^0.0.23",
74+
"myst-to-react": "^0.1.32",
75+
"myst-transforms": "^0.0.23"
7676
},
7777
"devDependencies": {
7878
"@babel/core": "^7.0.0",
7979
"@babel/preset-env": "^7.0.0",
8080
"@jupyterlab/builder": "^3.1.0",
8181
"@jupyterlab/testutils": "^3.0.0",
82-
"@myst-theme/styles": "^0.1.31",
82+
"@myst-theme/styles": "^0.1.32",
8383
"@tailwindcss/typography": "^0.5.8",
8484
"@types/jest": "^26.0.0",
8585
"@types/react-dom": "^18.0.10",

src/links.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const linkFactory =
7676
);
7777
}, [ref, url]);
7878
return (
79-
<a href={url} ref={ref}>
79+
<a href={url} ref={ref} className={props.className}>
8080
{props.children}
8181
</a>
8282
);

src/renderers.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import { DEFAULT_RENDERERS } from 'myst-to-react';
33
import { MermaidNodeRenderer } from '@myst-theme/diagrams';
44
import { NodeRenderer } from '@myst-theme/providers';
55
import { InlineRenderer } from './inlineExpression';
6+
import { listItem } from './taskItem';
67

78
export const renderers: Record<string, NodeRenderer> = {
89
...DEFAULT_RENDERERS,
910
mermaid: MermaidNodeRenderer,
1011
inlineExpression: (node, children) => {
1112
return <InlineRenderer value={node.value} />;
12-
}
13+
},
14+
listItem
1315
};

src/taskItem.tsx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import React from 'react';
2+
import { NodeRenderer } from '@myst-theme/providers';
3+
import type { ListItem } from 'myst-spec-ext';
4+
import { useJupyterCell } from './JupyterCellProvider';
5+
6+
function TaskItem({
7+
checked,
8+
line,
9+
children
10+
}: {
11+
checked?: boolean;
12+
children: React.ReactNode;
13+
line?: number;
14+
}) {
15+
// The rendering waiting on promises from Jupyter is slow
16+
// By keeping state here we can render fast & optimistically
17+
const [local, setLocal] = React.useState(checked ?? false);
18+
const { cell } = useJupyterCell();
19+
return (
20+
<li className="task-list-item">
21+
<input
22+
type="checkbox"
23+
disabled={!cell}
24+
className="task-list-item-checkbox"
25+
checked={local}
26+
onClick={() => {
27+
// Bail if no line number was found
28+
if (!cell || line == null) return;
29+
const text = cell.model.value.text;
30+
// This is a pretty cautious replacement for the identified line
31+
const lines = text.split('\n');
32+
lines[line] = lines[line].replace(
33+
/^(\s*(?:-|\*)\s*)(\[[\s|x]\])/,
34+
local ? '$1[ ]' : '$1[x]'
35+
);
36+
setLocal(!local);
37+
// Update the Jupyter cell markdown value
38+
cell.model.value.text = lines.join('\n');
39+
}}
40+
/>
41+
{children}
42+
</li>
43+
);
44+
}
45+
46+
export const listItem: NodeRenderer<ListItem> = (node, children) => {
47+
if (node.checked == null) {
48+
return <li key={node.key}>{children}</li>;
49+
}
50+
return (
51+
<TaskItem
52+
key={node.key}
53+
checked={node.checked}
54+
line={node.position?.start.line}
55+
>
56+
{children}
57+
</TaskItem>
58+
);
59+
};

style/tailwind.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
@import '@myst-theme/styles/math.css';
99
@import '@myst-theme/styles/cross-references.css';
1010
@import '@myst-theme/styles/block-styles.css';
11+
@import '@myst-theme/styles/tasklists.css';

0 commit comments

Comments
 (0)