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

Allow linebreaks in poll description and comments #500

Closed
rubo77 opened this issue Feb 3, 2019 · 5 comments
Closed

Allow linebreaks in poll description and comments #500

rubo77 opened this issue Feb 3, 2019 · 5 comments

Comments

@rubo77
Copy link

rubo77 commented Feb 3, 2019

It is not possible to add a newline in the output of the poll-description and in comments

If you add <br> it will shown as code there and if you add a line break, it are cut out completely of the output, not even replaced with a space, so the last character and the first of the new line glue together without space.

I can think of two solutions:

  1. allow <br> in comments and the description
  2. or render new lines as a visible New line in the output
  3. Allow markdown as in announcementcenter

I prefer the first or third solutions, the first is easy to achieve with PHP strip_tags, Example:

// allow <br> <p> and <a>:
echo strip_tags($text, '<br><p><a>');
@rubo77 rubo77 changed the title Allow linebreaks in Description Allow linebreaks in Description and comments Feb 3, 2019
@rubo77 rubo77 changed the title Allow linebreaks in Description and comments Allow linebreaks in poll description and comments Feb 3, 2019
@rubo77
Copy link
Author

rubo77 commented Feb 3, 2019

It is strange, cause this line already looks like it wouls show a BR in place of a new line:

https://github.com/nextcloud/polls/blob/master/templates/vote.tmpl.php#L96

		$description = str_replace(array('\r\n', '\r', '\n'), '<br/>', htmlspecialchars($poll->getDescription()));

The function getDescription is not in the Polls-sourcecode, so it may be a bug in another project?

I could think of a solution like this: add this line after the first str_replace:

		$description = preg_replace('/&lt;[bBrR]ş*\/*&gt;/', '<br/>', $description);

@dartcafe
Copy link
Collaborator

dartcafe commented Feb 3, 2019

HTML tags in the description are nearly a running gag. We had many problems including possible vulnerability. I think, this is something worth to be done in the migration of the vote page. After that things get a little bit easier.

@dartcafe dartcafe added this to the backlog milestone Feb 4, 2019
@rponline
Copy link

Allowing Markdown would be really nice

@dartcafe
Copy link
Collaborator

dartcafe commented Dec 9, 2019

#325

@dartcafe dartcafe closed this as completed Dec 9, 2019
@dartcafe dartcafe removed this from the backlog milestone Sep 21, 2020
Copy link

github-actions bot commented Jun 7, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants