Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linebreak (METAKEY + RETURN) in Nextcloud (19.0.1) Text App creates backslash at line ends in rendered html pages #566

Closed
herrtreffler opened this issue Sep 2, 2020 · 4 comments

Comments

@herrtreffler
Copy link

herrtreffler commented Sep 2, 2020

As @daftmilk mentioned in this issue Linebreaks in Texteditor do not conform to Markdown-Syntax the Nextcloud Text app indicates line-breaks with a "\" in the end of a line. I used the nl2br twig (3.x) filter in the themes index.twig file, which creates a html <br /> tag, but leaves the "\" character on line ends. Is there another Pico or Twig filter to replace the backslashs with a space or are changes in the config.yml necessary? I tried to chain | nl2br with | replace({"\\n":""}) but with no effort.

@PhrozenByte
Copy link
Collaborator

PhrozenByte commented Sep 2, 2020

I'm afraid Nextcloud's Text app isn't supported due to a lot of other, even more severe issues (like removing YAML Front Matters). There are plans to improve the situation, however, in the meantime I recommend using a different text editor, like https://apps.nextcloud.com/apps/files_markdown or https://apps.nextcloud.com/apps/files_texteditor

Besides: "\\n" actually reads as \ and n, not your intended \ and \n - \ is the escape character, thus \\ actually results in \. Try |replace({"\\\n": ""}) instead, it should do what you intend. However, I wouldn't chain it with |nl2br but directly transform it to <br />, resulting in |replace({"\\\n": "<br />"}).

By the way: This issue should rather be in https://github.com/nextcloud/cms_pico, this repo is about "pure" Pico 😄

@herrtreffler
Copy link
Author

😄 Damn. I was scared like hell to open my first issue on github, mostly beeing afraid to post it at the wrong place (which I did) or write off-topic-spam (like I do now). Feel free to move it to the right repo. I guess I'm not able to transfer it, do I?

Nevertheless your fix |replace({"\\\n": "<br />"}) did the job just perfect. Actually my intend was to use the text editor app, which comes as a preset in my NC installation, as a WYSWYG editor where users don't have to think about markup language. Even it limits Picos theme functionality, my basic website idea works even without YAML Front Matter. Or in other words: Pico is just awesome. I will return the favour for sure. 👍

@PhrozenByte
Copy link
Collaborator

😄 Damn. I was scared like hell to open my first issue on github, mostly beeing afraid to post it at the wrong place (which I did) or write off-topic-spam (like I do now). Feel free to move it to the right repo. I guess I'm not able to transfer it, do I?

Unfortunately we can't transfer the issue there. But no worries, it's not that of a big deal 😄 Don't hesitate to open another issue if you have any question.

@stale
Copy link

stale bot commented Sep 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! 👍

@stale stale bot added the info: Stale label Sep 11, 2020
@stale stale bot closed this as completed Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants