Unable to create poll when the last poll option starts with hashtag

markdown-it-review
poll

(Gerhard Schlager) #1

It’s not possible to create polls when the last poll option starts with a #.
@Adrian_D_Atri_Guiran discovered this bug.

This works:

[poll]
- #1
- 2
[/poll]

This doesn’t work:

[poll]
- 1
- #2
[/poll]

(Jeff Atwood) #2

Ok but… why should this matter? I agree it is a bug, but … don’t do that? :wink:


(Adrian D'atri Guiran) #3

It came from an import from an old phpbb3 forum. I had no idea what was crashing the importer script until i started editing files and printing stuff all over the place. I’m fine with the importer just skipping the poll, but hard crashing isn’t a super great solution, especially for people who are new to discourse and are migrating from phpbb and have absolutely no clue where to start looking for the problem.


(Gerhard Schlager) #4

I agree, the importer shouldn’t crash and I’ll fix that.
But the real issue is that the poll plugin has problems with certain text that looks like markdown.

This has problems too:

[poll]
- 24. November
- 26. November
[/poll]

There’s no problem when the last option doesn’t look like a numbered list:

[poll]
- 24. November
- 26. November
- some other date
[/poll]

Of course, that’s an option. :wink: But I guess documenting the issues is a better solution.

In case someone else stumbles upon the same problems, here’s an easy workaround: Escape the problematic symbols in the poll options by prepending \ to it. The following examples work:

[poll]
- 1
- \#2
[/poll]

[poll]
- 24. November
- 26\. November
[/poll]

(Loic Dachary) #5

Would you mind tagging this topic with poll ?


(Sam Saffron) #6

This is triggering a JavaScript error @tgxworld so it is worth fixing, if possible (at least stop console from filling with errors)

If too hard we can defer on #markdown-it-review


(Alan Tan) #8

Let’s defer it to #markdown-it-review, this is a bug in better-markdown.js where the following is generated incorrectly.


(Sam Saffron) #9

Yay this works now:

  • 1
  • #2

0 voters


(Sam Saffron) #10