(Video demo included) File crash and data loss caused by typing a specific comment code at the top of a YAML section

Steps to reproduce

  1. Make a new file.
  2. Create a YAML section at the top of the file.
  3. At the start of the YAML section, type <!---. (This is how to begin an HTML comment tag in a markdown file such that it will appear in HTML source output.)

Expected result

I expected the third dash in <!--- to appear. Then, I expected to be able to type whatever else I wanted.

Actual result

The third dash never even appears, nor do any other key inputs. Nothing happens if you try to backspace either. The file, but not the whole program, has frozen. Furthermore, if you try to switch to a different document and come back, you’ll find that the document is now blank.

Environment

  • Operating system: macOS 10.5.5
  • Obsidian version: 0.7.3

Additional information

You can watch a very short demonstration of the bug here.

The data loss can be prevented if you take a specific action right away. Once the file is frozen, immediately quit Obsidian instead of attempting to refresh the tab by going to a different tab and coming back (like I did when I first encountered the bug, unfortunately). Open the file in a different text editor, remove the offending comment code, and then you can resume editing the file in Obsidian. In case you ever happen to experience anything similar to this bug, remember this so that you can (hopefully) recover your work before it’s overwritten and lost forever.

Thank you, I can reproduce. we’ll look into it.

1 Like

Editor enters in a loop and keeps throwing this error:

codemirror.js:1175 Uncaught Error: Mode hypermd failed to advance stream.
    at readToken (codemirror.js:1175)
    at runMode (codemirror.js:1229)
    at highlightLine (codemirror.js:1075)
    at codemirror.js:3969
    at LeafChunk.iterN (codemirror.js:5627)
    at Doc.iterN (codemirror.js:5739)
    at Doc.iter (codemirror.js:6137)
    at highlightWorker (codemirror.js:3965)
    at Delayed.f (codemirror.js:148)
    at Delayed.onTimeout (codemirror.js:185)

Can repro as well. Will fix asap.

1 Like

Will be fixed in 0.7.5.

1 Like