silverbulletmd / silverbullet

The knowledge hacker's notebook
https://silverbullet.md
MIT License
2.14k stars 155 forks source link

Issues with tilde-delimited code blocks #693

Closed Maarrk closed 5 months ago

Maarrk commented 5 months ago

Expected result: Fenced code block behaves the same way when delimited with backticks and tildes, since they are not distinguished in CommonMark Spec, which is identified in Markdown page on the main instance.

I only found out about this syntax today, but it is really useful since we can share templates and space script using that.

Observed results:

  1. A code block with tildes can be edited, and has correct syntax hints, but neither keyboard nor mouse can exit editing it
  2. When refreshing the page contents stay empty

Reproduction rate: 5/5 on Chrome, including PWA, and Firefox

Appendix:

Error thrown for 1:

fenced_code.ts:24 Uncaught TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
    at enter (fenced_code.ts:24:29)
    at Ub.iterate (common.mjs:2:3482)
    at fenced_code.ts:16:23
    at YR.update [as updateF] (util.ts:100:14)
    at Object.update (state.mjs:5:17052)
    at ts.computeSlot (state.mjs:5:25661)
    at jp (state.mjs:5:19840)
    at new ts (state.mjs:5:24855)
    at ts.applyTransaction (state.mjs:5:25631)
    at get state (state.mjs:5:21304)

Error thrown for 2:

TypeError: a.match(...) is null
    enter fenced_code.ts:24
    iterate common.mjs:2
    JV fenced_code.ts:16
    create util.ts:95
    create state.mjs:5
    create state.mjs:5
    create state.mjs:5
    jp state.mjs:5
    ts state.mjs:5
    create state.mjs:5
    pb editor_state.ts:62
    loadPage client.ts:1038
async.ts:99:12
    Ni async.ts:99