Skip to content

[Bug]: Using standard Markdown code block syntax ``` in a snippet causes everything following to be deleted #696

Closed

Description

@BryanWall

Describe the bug

I just tried moving all of my SnippetsLab snippets to massCode and discovered that massCode will delete everything in a file following 3 consecutive backticks. It doesn't seem to matter what language the file is set to.

Three backticks is the standard for code blocks in Markdown almost everywhere, including Github, so it shouldn't cause part of a snippet to be wiped. It should be possible to store valid Markdown in a snippet.
https://www.markdownguide.org/extended-syntax/#fenced-code-blocks

To reproduce

Assumes that the user is using Markdown as the storage method instead of Sqlite

  1. Create a snippet
  2. Set language to Markdown (or anything else)
  3. Paste in some Markdown content which includes standard Markdown code blocks (surrounded by 3 backticks), or paste in any content and type 3 backticks at the start of a line
  4. Select something else so the snippet is saved to disk, or wait until massCode auto-saves the file
  5. Anything in the file after the first set of 3 backticks is deleted

This happens even if the language is set to "Plain Text". It doesn't have to be set to Markdown for this issue to happen.

The documentation here suggests that code blocks can be displayed in a snippet, so I assume this should be possible:
https://masscode.io/documentation/markdown.html#render-code-blocks

You can use the raw Markdown from this Github project readme.md as an example. Just paste this into a Markdown snippet in massCode and it will delete everything after the first set of 3 backticks after a few seconds:
https://raw.githubusercontent.com/chicagocomputerclasses/SUPERSQL-Google-Sheets-Function/refs/heads/master/README.md

I assume this is happening because massCode uses 3 backticks as the container for fragments.

App Version and Architecture

4.7.1

System info

System:
    OS: macOS 26.3.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 149.80 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh

Validations

Activity

  1. changed the title [-][Bug]: Anything after standard Markdown code block syntax ``` is deleted automatically by massCode[/-] [+][Bug]: Using standard Markdown code block syntax ``` in a snippet causes everything following to be irreversibly deleted[/+] on Mar 17, 2026
  2. changed the title [-][Bug]: Using standard Markdown code block syntax ``` in a snippet causes everything following to be irreversibly deleted[/-] [+][Bug]: Using standard Markdown code block syntax ``` in a snippet causes everything following to be hidden[/+] on Mar 17, 2026
  3. BryanWall commented on Mar 17, 2026

    @BryanWall
    Author

    I just tried testing it by putting the example from the documentation here in a snippet:

    https://masscode.io/documentation/markdown.html#mermaid-diagrams

    Even pasting this example into a snippet causes it to be instantly deleted. Here's a screen recording. A couple of seconds after I paste in the Markdown, it is deleted. When it disappears, that is massCode deleting it, not me.

    Edit: Just typing 3 backticks in any snippet will cause everything following to be deleted

    Screen.Recording.2026-03-17.at.3.24.33.PM.mov
  4. changed the title [-][Bug]: Using standard Markdown code block syntax ``` in a snippet causes everything following to be hidden[/-] [+][Bug]: Using standard Markdown code block syntax ``` in a snippet causes everything following to be deleted[/+] on Mar 17, 2026
  5. luojunqiang commented on Mar 27, 2026

    @luojunqiang

    I'm new to this software and am experiencing the same issue when using the Markdown format vault. I prefer not to use the SQLite format, so I haven't tested it.

    I’ve noticed that massCode uses Markdown documents to save snippet content, employing '```' to separate the fragment content from other metadata. However, when there is a '```' in the snippet itself, it leads to parsing problems. Currently, I have to use '~~~' instead of '```' for code blocks.

    I believe that:

    • MassCode should escape any instances of '```' in the snippet content before saving it to the Markdown file.
    • MassCode could use a more effective separator, such as '````````````' or '~~~~~~~~~~', to ensure that most snippet content remains unaffected.
  6. serial commented on Mar 27, 2026

    @serial

    In the meantime, using ~~~ (tildes) instead of ``` (backticks) for fenced code blocks works as a workaround, since tildes don't collide with the vault format's outer wrapping.

  7. BryanWall commented on Mar 31, 2026

    @BryanWall
    Author

    Version 5.0.0 has been released without acknowledgement of this issue. The wrapper for fragments has been changed to a heading starting with "## Fragment: Fragment" followed by a line with 4 backticks.

    The issue doesn't seem to happen now, but now Markdown rendering doesn't work at all in fragments.

  8. antonreshetov commented on Mar 31, 2026

    @antonreshetov
    Member

    In version 5, markdown snippets have become just snippets, everything related to markdown is obviously in the Notes space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions