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

**URL:** https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960
**Category:** Bug
**Tags:** markdown-it-review, polls
**Created:** [23 Novembre 2015, 11:02pm UTC](https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960 "2015-11-23T23:02:40Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [23 Novembre 2015, 11:02pm UTC](https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960/1 "2015-11-23T23:02:41Z")

</div>

It’s not possible to create polls when the last poll option starts with a #.  
@anon36895752 [discovered this bug](https://meta.discourse.org/t/importing-from-phpbb3/30810/14).

This works:

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

```

This doesn’t work:

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

```

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [23 Novembre 2015, 11:26pm UTC](https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960/2 "2015-11-23T23:26:02Z")

</div>

Ok but.. why should this matter? I agree it is a bug, but .. don’t do that? 😉

---

<div class="post-metadata">

### Author: ![anon36895752](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@anon36895752](https://meta.discourse.org/u/anon36895752)
#### Post date: [23 Novembre 2015, 11:35pm UTC](https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960/3 "2015-11-23T23:35:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [23 Novembre 2015, 11:48pm UTC](https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960/4 "2015-11-23T23:48:34Z")

</div>

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:

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

```

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

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

```

> [@codinghorror](#):
>
> don’t do that? 😉

Of course, that’s an option. 😉 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:

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

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

```

---

<div class="post-metadata">

### Author: ![dachary](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dachary/32/119731_2.png) [@dachary](https://meta.discourse.org/u/dachary)
#### Post date: [13 Luglio 2016, 5:56pm UTC](https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960/5 "2016-07-13T17:56:46Z")

</div>

Would you mind tagging this topic with **poll**?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [16 Maggio 2017, 9:50pm UTC](https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960/6 "2017-05-16T21:50:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [5 Giugno 2017, 3:44am UTC](https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960/8 "2017-06-05T03:44:34Z")

</div>

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

![](https://global.discourse-cdn.com/meta/original/3X/4/6/4669560e08ec58586f9cdfd09579cb531e7c7855.png)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [26 Giugno 2017, 2:11pm UTC](https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960/9 "2017-06-26T14:11:16Z")

</div>

Yay this works now:

_Poll ([view on site](https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960/9))_

> [@CommonMark testing started here!](https://meta.discourse.org/t/commonmark-testing-started-here/65121):
>
> Per our [migration plans](https://meta.discourse.org/t/discourse-commonmark-migration-plans-confetti-ball-balloon), I just enabled [markdown.it](https://github.com/markdown-it/markdown-it) at Meta. It is an excellent [CommonMark](http://commonmark.org/) compliant engine. I expect quite a few edges to be found during this period of testing. Do not open bugs about the new Engine, just reply here. I/we will be updating the top post here with the list of issues and striking out stuff as it is fixed. Current known issues (to be fixed)white_check_mark Onebox vanishes after you start typing and works not-super consistently white_check_mark pending…

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [26 Giugno 2017, 2:11pm UTC](https://meta.discourse.org/t/unable-to-create-poll-when-the-last-poll-option-starts-with-hashtag/35960/10 "2017-06-26T14:11:20Z")

</div>


