You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Escaping of square brackets breaks links of embedded attachments for external Markdown Editor #4795
I'm using an external Markdown Editor (Obsidian) and sync the files via the NextCloud Desktop Client to the server. When saving a markdown file with the NextCloud text editor in the web interface, the links for embedded attachements are broken, because the square brackets are escaped with a backslash. Can this escaping for square brackets (or other chars) manually turned off?
Markdown syntax is not properly rendered in text
Markdown syntax is removed after closing text
Markdown syntax is changed after closing text
Something else: Please describe more in detail
Example markdown content
![[Pasted image 20230908203759.png]]
Resulting markdown content after saving
!\[\[Pasted image 20230908203759.png\]\]
Screenshot of the rendering in text
Details
Nextcloud version: Nextcloud AIO v7.1.1
Reacted by Young Shung, Matthias, Vinzent, Christoph Michel, Reddol, Giorgio Mariani, PhD, Edoardo Costantini and Maximilian Maria Richter
Yes, this embedded attachment is put as separate file besides the markdown file and is rendered as image element. Of course, it would be brilliant if the NextCloud text editor could also render these ;)
As a side note: I kind of like this syntax for "embedding files or links". This could also be interesting to separate a bit more between link previews and parts where people actually want to embed the file content (like a pdf that is rendered inline) - though that is probably something for a different discussion.
No objections at all. I actually like the syntax and the distinction between embedded content and links.
First of all I think we should make sure not to mess with the syntax.
Reacted by Julius Knorr, Chris Daßler, Jonas and Lukas
I noticed the same issue but for a different reason.
I wanted to add a link to a website but with the link embedded in text.
The markdown standard supports this in the following way: [Link](http://a.com)markdown website
But as the issue says the "[" and "]" are escaped with a backslash in the nextcloud text editor and it does not work.
Is it possible to disable the escaping of this character?
Or have an option in the menu to do this or using the smart picker, just some ideas.
I noticed the same issue but for a different reason. I wanted to add a link to a website but with the link embedded in text. The markdown standard supports this in the following way: [Link](http://a.com)markdown website But as the issue says the "[" and "]" are escaped with a backslash in the nextcloud text editor and it does not work.
Is it possible to disable the escaping of this character? Or have an option in the menu to do this or using the smart picker, just some ideas.
Thanks!
This is likely a different topic. We already support []() links in the markdown source, just not during typing. Maybe you can open a separate issue for that.
You can already create such links through the menu when marking existing text.
I think there is something else goin on here.... What would be the explanation for this? y\~
My original text was y~ along with some other password like characters.... Not a ([] or ) in sight.... Or {} either for that matter... Unless starting a line with & is illegal?
Is there any workaround anyone has found?
I'm using Obsidian too and it makes switching between editing in nextcloud and obsidian painful due to breaking all the links.
Is there a way to get raw editing or hook into file save to run my own cleanup script or something?
Is there any workaround anyone has found? I'm using Obsidian too and it makes switching between editing in nextcloud and obsidian painful due to breaking all the links.
Is there a way to get raw editing or hook into file save to run my own cleanup script or something?
Same issue here! Tried putting the Markdown editor in read-only mode, but even then it edits the files! This should absolutely not happen when something is in read-only mode.
Reacted by Giorgio Mariani, PhD and Edoardo Costantini
Same issue here. Saving a markdown file with wikilinks results in the addition of a backslash (\) before the opened and closed squared bracket of the internal reference.
Bumping this because it seems like a lossy round-trip serialization bug, not just a rendering issue.
"![[...]]" is Obsidian wikilink/embed syntax, not plain text. Right now, opening and saving a file appears to flatten that existing source syntax into text and then escape "[" / "]", which rewrites: ![[Pasted image 20230908203759.png]]
to !\[\[Pasted image 20230908203759.png\]\]
That means the editor is not preserving existing Markdown source faithfully. Even if full Obsidian syntax support is out of scope, opening and saving a file without editing that construct should not rewrite it.
Escaping still makes sense for newly entered literal text. The problem is applying that escaping to already-authored source syntax during round-trip.
A safer fix would be to either preserve unknown constructs verbatim, or ensure wikilink/embed syntax does not go through the generic text escaping path.
Activity
juliusknorr commentedon Sep 14, 2023
Thanks for the report. Can you tell how Obsidian renders this? Is it just a regular image element with a relative path to the image?
chrda81 commentedon Sep 14, 2023
Yes, this embedded attachment is put as separate file besides the markdown file and is rendered as image element. Of course, it would be brilliant if the NextCloud text editor could also render these ;)
juliusknorr commentedon Sep 14, 2023
Kind of related to #1065 but while i commented back then I feel less hesitant to add those if we just cover them to preserve syntax for now.
This would need a few steps though:
Most relevant spec for Obsidian is this one https://help.obsidian.md/Linking+notes+and+files/Embedding+files
As a side note: I kind of like this syntax for "embedding files or links". This could also be interesting to separate a bit more between link previews and parts where people actually want to embed the file content (like a pdf that is rendered inline) - though that is probably something for a different discussion.
juliusknorr commentedon Sep 14, 2023
@max-nextcloud @mejo- Any thoughts or objections on adding support for that syntax?
max-nextcloud commentedon Sep 15, 2023
No objections at all. I actually like the syntax and the distinction between embedded content and links.
First of all I think we should make sure not to mess with the syntax.
Mat-DB commentedon Oct 8, 2023
I noticed the same issue but for a different reason.
I wanted to add a link to a website but with the link embedded in text.
The markdown standard supports this in the following way:
[Link](http://a.com)markdown websiteBut as the issue says the "[" and "]" are escaped with a backslash in the nextcloud text editor and it does not work.
Is it possible to disable the escaping of this character?
Or have an option in the menu to do this or using the smart picker, just some ideas.
Thanks!
juliusknorr commentedon Oct 12, 2023
This is likely a different topic. We already support
[]()links in the markdown source, just not during typing. Maybe you can open a separate issue for that.You can already create such links through the menu when marking existing text.
sn0n commentedon Feb 18, 2024
I think there is something else goin on here.... What would be the explanation for this?
y\~My original text was
y~along with some other password like characters.... Not a([]or)in sight.... Or{}either for that matter... Unless starting a line with&is illegal?sn0n commentedon Feb 18, 2024
Maybe some xss filter trying to do its sanitation?
KFreon commentedon Mar 27, 2024
Is there any workaround anyone has found?
I'm using Obsidian too and it makes switching between editing in nextcloud and obsidian painful due to breaking all the links.
Is there a way to get raw editing or hook into file save to run my own cleanup script or something?
janLo commentedon Apr 29, 2024
I used to use https://apps.nextcloud.com/apps/files_markdown. But it's a pita that NC decided to not allow to change the default away from texts.
I've also got this issue if I just want to share a note for viewing. It gets open in the text app and is broken.
Even if there is no support or exception for unsupported syntax, the app should not change the content if no input was made.
KFreon commentedon May 6, 2024
I've ended up writing an Obsidian plugin to fix them.
Looking to get it published to the Obsidian list for use.
13 remaining items
MrToph commentedon Feb 1, 2026
same issue for me, nextcloud web shouldn't alter text files upon viewing, this leads to pure synchronization chaos
LuvForAirplanes commentedon Feb 2, 2026
I would be happy to contribute if pointed in the right direction.
Arjenlodder commentedon Feb 13, 2026
Same issue here! Tried putting the Markdown editor in read-only mode, but even then it edits the files! This should absolutely not happen when something is in read-only mode.
EdoardoCostantini commentedon Mar 30, 2026
Same issue here. Saving a markdown file with wikilinks results in the addition of a backslash (
\) before the opened and closed squared bracket of the internal reference.Example markdown content
Resulting markdown content after saving
NEET-FEET commentedon Apr 14, 2026
Bumping this because it seems like a lossy round-trip serialization bug, not just a rendering issue.
"![[...]]" is Obsidian wikilink/embed syntax, not plain text. Right now, opening and saving a file appears to flatten that existing source syntax into text and then escape "[" / "]", which rewrites:
![[Pasted image 20230908203759.png]]to
!\[\[Pasted image 20230908203759.png\]\]That means the editor is not preserving existing Markdown source faithfully. Even if full Obsidian syntax support is out of scope, opening and saving a file without editing that construct should not rewrite it.
Escaping still makes sense for newly entered literal text. The problem is applying that escaping to already-authored source syntax during round-trip.
A safer fix would be to either preserve unknown constructs verbatim, or ensure wikilink/embed syntax does not go through the generic text escaping path.
LuvForAirplanes commentedon Apr 15, 2026
If you all can put steam behind this one, it fixes the issue: #8420
feat(markdown): add support for wiki-style links
feat(markdown): add support for wiki-style image links
feat(markdown): add support for wiki-style links
feat(markdown): add support for wiki-style links
feat(markdown): add support for wiki-style links