Commit 41a0500
improvement: markdown code to be completely hidden upon 'Hide Code' (#2974)
## 📝 Summary
<!--
Provide a concise summary of what this pull request is addressing.
If this PR fixes any issues, list them here by number (e.g., Fixes
#123).
-->
Fixes #2678 . Markdown code will be completely hidden to offer less
distraction. This PR adds Double click / Enter as shortcuts to display
markdown code, similar to Jupyter notebooks.
https://github.com/user-attachments/assets/8fd832de-14cf-4835-a31a-87c6843bca50
<img width="806" alt="Screenshot 2024-12-01 at 12 47 36 AM"
src="https://github.com/user-attachments/assets/42290d9f-e5b6-457d-9918-84026526a28b">
- Had to make some design compromises (widening the gap btwn left
buttons when there is a Collapse toggle, rly hard to get this right with
various markdown sizes). If you have another idea in mind, let me know.
## 🔍 Description of Changes
<!--
Detail the specific changes made in this pull request. Explain the
problem addressed and how it was resolved. If applicable, provide before
and after comparisons, screenshots, or any relevant details to help
reviewers understand the changes easily.
-->
- attach a resizeObserver for markdown cells, when the cell is too
short, the icons on the right will overlap. A resize observer is used to
add a css class to make the icon inline
- changed some props to be optional so that scratchpad will work fine
- some refactors, including `temporarilyShowCode` function change from
async to sync
## 📋 Checklist
- [X] I have read the [contributor
guidelines](https://github.com/marimo-team/marimo/blob/main/CONTRIBUTING.md).
- [ ] For large changes, or changes that affect the public API: this
change was discussed or approved through an issue, on
[Discord](https://marimo.io/discord?ref=pr), or the community
[discussions](https://github.com/marimo-team/marimo/discussions) (Please
provide a link if applicable).
- [ ] I have added tests for the changes made.
- [X] I have run the code and verified that it works as expected.
## 📜 Reviewers
<!--
Tag potential reviewers from the community or maintainers who might be
interested in reviewing this pull request.
Your PR will be reviewed more quickly if you can figure out the right
person to tag with @ -->
@akshayka OR @mscolnick
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent 9c47539 commit 41a0500
File tree
9 files changed
+420
-73
lines changed- frontend
- e2e-tests
- src
- components
- editor
- cell/code
- code
- scratchpad
- hooks
- __tests__
9 files changed
+420
-73
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
216 | 218 | | |
217 | 219 | | |
218 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 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 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| |||
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
| 189 | + | |
| 190 | + | |
186 | 191 | | |
187 | 192 | | |
188 | 193 | | |
| |||
311 | 316 | | |
312 | 317 | | |
313 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
314 | 378 | | |
315 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
316 | 395 | | |
317 | | - | |
| 396 | + | |
318 | 397 | | |
319 | 398 | | |
320 | 399 | | |
| |||
325 | 404 | | |
326 | 405 | | |
327 | 406 | | |
328 | | - | |
| 407 | + | |
329 | 408 | | |
330 | 409 | | |
331 | 410 | | |
| |||
335 | 414 | | |
336 | 415 | | |
337 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
338 | 423 | | |
339 | 424 | | |
340 | 425 | | |
| |||
350 | 435 | | |
351 | 436 | | |
352 | 437 | | |
353 | | - | |
354 | | - | |
355 | 438 | | |
356 | 439 | | |
357 | 440 | | |
| |||
416 | 499 | | |
417 | 500 | | |
418 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
419 | 506 | | |
420 | 507 | | |
421 | 508 | | |
| |||
462 | 549 | | |
463 | 550 | | |
464 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
465 | 567 | | |
466 | 568 | | |
467 | 569 | | |
| |||
481 | 583 | | |
482 | 584 | | |
483 | 585 | | |
484 | | - | |
| 586 | + | |
485 | 587 | | |
486 | | - | |
| 588 | + | |
487 | 589 | | |
488 | 590 | | |
489 | 591 | | |
| |||
499 | 601 | | |
500 | 602 | | |
501 | 603 | | |
502 | | - | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
503 | 611 | | |
504 | 612 | | |
505 | 613 | | |
| |||
532 | 640 | | |
533 | 641 | | |
534 | 642 | | |
| 643 | + | |
535 | 644 | | |
536 | | - | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
537 | 648 | | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
| 649 | + | |
| 650 | + | |
551 | 651 | | |
552 | 652 | | |
| 653 | + | |
553 | 654 | | |
554 | 655 | | |
555 | 656 | | |
| |||
644 | 745 | | |
645 | 746 | | |
646 | 747 | | |
647 | | - | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
648 | 753 | | |
649 | 754 | | |
650 | 755 | | |
| |||
0 commit comments