marktext / marktext/marktext

On loading a file, everything but the first word gets stripped from the info string of code blocks

Open
#2,512 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

:beetle: pri/major :octocat: code block 🐛 bug
Dominant language
TypeScript
Stars
61.6k
Forks
4.6k
Avg merge
23h 49m
Merged PRs (30d)
89

Description

Description

When opening a markdown file, everything but the first word is stripped from the info string of a fenced code block.

  • Can you reproduce the issue?
Steps to reproduce
  1. Create a file test.md with the content
# Test

```json test
{"test":"doesnt matter"}
```
  1. Open the file in MarkText.

Expected behavior:

I expect MarkText to use the first word of the info string to identify the language for highlighting and ignore the rest. And by "ignore" I mean, do not touch it and when saving the file, write it out to disk, again.

Actual behavior:

Markdown correctly uses the first word of the info string to identify the language for highlighting, but then discards the rest. When the file is saved, only the first word of the info string is written to disk.

Background

I use a Literate Programming system that uses the info string to add labels to code blocks. So, naturely, I need these labels to be preserved when using MarkText for editing.

Versions
  • Mark Text version: 0.16.3
  • Operating system: Windows 10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the problem with the test.md file and the fenced block containing the json test info string. Compare the loaded document with the saved output; done means the first word still identifies the language while the remaining info-string text is preserved on disk.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, typescript
Domain
content
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.