text icon indicating copy to clipboard operation
text copied to clipboard

Messed up entire markdown syntax

Open vittorio-c opened this issue 3 years ago • 2 comments

Describe the bug

The app messed up the entire markdown syntax of my file.

To Reproduce

Steps to reproduce the behavior:

  1. Create a markdown file in your regular markdown editor.
  2. Add normal stuff like lists, break lines, code fences, math expressions.
  3. Then open up your file in the "nextcloud/text" app and save the file.
  4. Open back your file in your regular markdown editor, and see errors : all your makrdown syntax is entirely messed up :
  • Backslash are added on every single math anotations.
  • Break lines are removed.
  • Lists '-' are replaced with '*'.
  • '<' and '>' in URL are simply... removed.
  • Langage indices (ex: 'python') in code fences are removed.

Is this normal behavior ? It sounds like the app is trying to avoid langage injection, or something like this. But I don't see why, since it's just regular file. There is no "excecution" capability in markdown file, isn't it ?

Expected behavior

None of my markdown syntax is touched.

Client details:

  • OS: Linux Manjaro 5
  • Browser: Firefox
  • Device: Desktop

Text app version: 3.5.1

Web server: Nextcloud 24

vittorio-c avatar Jun 18 '22 11:06 vittorio-c

Just as a user:

  • Backslash are added on every single math anotations.

  • Break lines are removed.

Sounds bad, probably a bug?

  • Lists '-' are replaced with '*'.

the text-app uses markdown-it to convert the markdown to html and, then tiptap to edit the html and prosemirror to recreate markdown. So this is normal behavior as markdown-it parses it as a list and tiptap also recreates a markdown list, the previous style is simply not saved and the common mark specs say both are equal (tiptap preferes *).

  • '<' and '>' in URL are simply... removed.

But both characters are not even allowed within an URL. So I would guess some of the used libraries simply validates the URL. See also rfc3986

  • Langage indices (ex: 'python') in code fences are removed.

That's also sound's like a bug, as markdown-it and tiptap should support those (covered by commonmark specs)

susnux avatar Jun 21 '22 06:06 susnux

I assume this is related to https://github.com/nextcloud/text/issues/593

XueSheng-GIT avatar Jun 21 '22 10:06 XueSheng-GIT

Since this ticket contains different separate topics, I'll close this and would ask you to open individual issues for each syntax problem together with a simple markdown example to reproduce.

Langage indices (ex: 'python') in code fences are removed.

I could reproduce this and opened https://github.com/nextcloud/text/issues/3328

'<' and '>' in URL are simply... removed.

I cannot reproduce this, so if you have an example file a separate issue would be highly appreciated.

Backslash are added on every single math anotations. Break lines are removed. Lists '-' are replaced with '*'.

Could you please open a separate issue with an example markdown file that shows specifically this issue?

juliusknorr avatar Oct 28 '22 07:10 juliusknorr

Just for reference:

'<' and '>' in URL are simply... removed.

:heavy_check_mark: Should have been resolved with https://github.com/ProseMirror/prosemirror-markdown/commit/48170d4e69e30d7122fbe2a20a0031c4110c5a82

Backslash are added on every single math anotations.

:heavy_check_mark: Should have been resolved with #2704

Break lines are removed.

:heavy_check_mark: Was resolved by #2720

Lists '-' are replaced with '*'

:grey_question: Still open, but hard to implement as both are semantically the same, this should not hurt.

susnux avatar Oct 28 '22 09:10 susnux