Skip to content

Markdown file has wrong formatting after simple save operation #781

@N0rbert

Description

@N0rbert

Describe the bug
mdSilo modifies correct file and make it wrongly formatted.

To Reproduce
Create the following correct Markdown file in the shell:

mkdir /tmp/mdsilo
cat <<"EOF" > /tmp/mdsilo/file.md
# Simple Markdown document

Ordered list is below:

1. One
1. Two
1. Three

Unordered list is below:

* red;
* green;
* orange.

Bash script is below:

```bash
date
```

Two links in the list:

1. [`mdl`](https://rubygems.org/gems/mdl)
1. [`remark`](https://github.com/remarkjs/remark)

Two links in the text - [`mdl`](https://rubygems.org/gems/mdl), [remark](https://github.com/remarkjs/remark).

Third link - [file from `r4ds-exercise-solutions`](https://github.com/jrnold/r4ds-exercise-solutions/blob/master/.remarkrc).

Footnote is here [^fn1]

[^fn1]: the footnote text.

Some LaTeX text placed here intentionally for bookdown and xaringan:
\@ref(eq:do-no-touch-me), \eqref{binom_eq} and \@ref(exm:listing2-name).

Some text.
EOF

ensure that this file is correct by running Markdown lint tool:

$ mdl file.md
$

and open this file using mdSilo to put some new characters at the last line and save it (for example replace Some text. with Some text at the end..

Expected behavior
The resulting Markdown file is correct file and its contents is different from the snippet above only at the last line.

Screenshots

$ cat file.md 
# Simple Markdown document

Ordered list is below:


1. One
2. Two
3. Three

Unordered list is below:

- red;
- green;
- orange.

Bash script is below:

```bash
date
```

Two links in the list:


1. `mdl`
2. `remark`

Two links in the text - `mdl`, [remark](https://github.com/remarkjs/remark).

Third link - [file from ](https://github.com/jrnold/r4ds-exercise-solutions/blob/master/.remarkrc)`r4ds-exercise-solutions`.

Footnote is here \[^fn1\]

\[^fn1\]: the footnote text.

Some LaTeX text placed here intentionally for bookdown and xaringan:
@ref(eq:do-no-touch-me), \\eqref{binom_eq} and @ref(exm:listing2-name).

Some text at the end.

$ mdl file.md
file.md:5: MD012 Multiple consecutive blank lines
file.md:24: MD012 Multiple consecutive blank lines
file.md:7: MD029 Ordered list item prefix
file.md:8: MD029 Ordered list item prefix
file.md:26: MD029 Ordered list item prefix
file.md:30: MD039 Spaces inside link text
file.md:39: MD047 File should end with a single newline character

Desktop (please complete the following information):

  • Debian 12.9 amd64 with all updates
  • mdSilo 0.5.9

Additional context
mdl 0.12.0

Are you willing to submit a PR?
No.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions