Commit 26f6ced
Add block text highlighting in instruction panel (#1584)
Closes
RaspberryPiFoundation/digital-editor-issues#1690
## Block-type text highlighting
- Used
[rpf-markdown-core](https://github.com/RaspberryPiFoundation/rpf-markdown-core)
(built by the Code Club team) for rendering instructions, chosen for its
inline Kramdown class support.
- Refactored the css file so that they apply to both light and dark mode
without breaking others.
| Before | After |
| -------- | ------- |
| <img width="392" height="349" alt="Screenshot 2026-08-10 at 17 02 22"
src="https://github.com/user-attachments/assets/907a3a46-c871-4128-8f2d-081a9293edcf"
/> | <img width="395" height="364" alt="Screenshot 2026-08-10 at 17 04
13"
src="https://github.com/user-attachments/assets/8ac0b8f3-9a34-45ae-b134-334f8a98454a"
/> |
## Prism and other fixes
- While doing this work, I found Prism had stopped working possibly due
to the partial Vite migration. Prism provides syntax highlighting, line
numbering and line highlighting in code blocks of instructions.
Classroom and ExpCS instructions don't use these currently, but CCP
instructions do (and CCP team also noticed this when running projects
site locally along with latest editor-ui).
<img width="360" alt="Screenshot 2026-08-10 at 17 02 57"
src="https://github.com/user-attachments/assets/6d134da6-0bb3-476f-8c80-08a3cacb9456"
/>
- The existing `vite.lib.js` configured `babel-plugin-prismjs` via
@vitejs/plugin-react's babel option. But the plugin-react v6 no longer
has, so the config was ignored. Replaced with explicit imports in
src/utils/prism.js.
- In dev environment, `vite-plugin-node-polyfills` prepends a shim
banner to every pre-bundled dependency without terminating the last
statement. Prism's plugin files start with (function(){…})(), so it was
parsed as an argument to the shim and then short-circuited away,
resulting in line-numbers and line-highlight not registered. Worked
around with optimizeDeps.exclude in vite.config.js.
- Jest couldn't load any test importing rpf-markdown-core. Its CJS build
requires marked and scratchblocks, both ESM-only with no CommonJS entry.
Updated transformIgnorePatterns to exempt both, matched against the full
path so the nested rpf-markdown-core/node_modules/scratchblocks copy is
also covered.
## Can our users use any other features that the rpf-markdown-core
provides?
- Not yet. There are some styling issues with others which we need to
address first.
- CCP team is also open to collaboration if we require certain set of
functionalities from or improvements to the library.
| Spacing issues | issues with dark mode |
| -------- | ------- |
| <img width="400" height="580" alt="Screenshot 2026-08-10 at 17 04 34"
src="https://github.com/user-attachments/assets/8b5e80ff-5f78-4857-9adc-21d5ee06387c"
/> | <img width="400" alt="Screenshot 2026-08-10 at 17 19 52"
src="https://github.com/user-attachments/assets/044320f4-70ee-4017-8b4f-4b5c95753e14"
/> |1 parent 91d2d23 commit 26f6ced
15 files changed
Lines changed: 307 additions & 181 deletions
File tree
- src
- assets/stylesheets
- components/Menus/Sidebar/InstructionsPanel
- InstructionsStep
- containers
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 2 | + | |
19 | 3 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | 113 | | |
115 | 114 | | |
116 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
40 | 15 | | |
41 | 16 | | |
42 | 17 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 18 | + | |
53 | 19 | | |
54 | 20 | | |
55 | 21 | | |
| |||
416 | 382 | | |
417 | 383 | | |
418 | 384 | | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
423 | 389 | | |
424 | 390 | | |
425 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
3 | 19 | | |
4 | 20 | | |
5 | 21 | | |
| |||
Lines changed: 1 addition & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 11 | + | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
279 | 275 | | |
280 | 276 | | |
281 | 277 | | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | 278 | | |
288 | 279 | | |
289 | 280 | | |
| |||
Lines changed: 13 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | 6 | | |
14 | 7 | | |
15 | 8 | | |
16 | 9 | | |
17 | | - | |
| 10 | + | |
18 | 11 | | |
19 | 12 | | |
20 | 13 | | |
| |||
23 | 16 | | |
24 | 17 | | |
25 | 18 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
31 | 28 | | |
32 | 29 | | |
33 | 30 | | |
| |||
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 39 | | |
60 | 40 | | |
61 | 41 | | |
62 | 42 | | |
63 | 43 | | |
64 | 44 | | |
| 45 | + | |
65 | 46 | | |
66 | 47 | | |
67 | 48 | | |
| |||
Lines changed: 34 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
50 | 83 | | |
51 | 84 | | |
52 | 85 | | |
| |||
66 | 99 | | |
67 | 100 | | |
68 | 101 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | 102 | | |
87 | 103 | | |
88 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | 207 | | |
226 | 208 | | |
227 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
| |||
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 105 | | |
111 | 106 | | |
112 | 107 | | |
| |||
0 commit comments