# CommonMark testing started here!

**URL:** https://meta.discourse.org/t/commonmark-testing-started-here/65121
**Category:** Feature
**Created:** [June 26, 2017, 12:44pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121 "2017-06-26T12:44:40Z")
**Posts on this page:** 20
**Page:** 3

<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: [June 29, 2017, 8:05pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/49 "2017-06-29T20:05:14Z")

</div>

And with this commit I am done with core!

[https://github.com/discourse/discourse/commit/d941ed90d6c12a8bf0c8b922076cb6eca8114816](https://github.com/discourse/discourse/commit/d941ed90d6c12a8bf0c8b922076cb6eca8114816)

There are no open issues any more, so I am moving on to fixing up plugins.

---

<div class="post-metadata">

### Author: ![vchuravy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vchuravy/32/120525_2.png) [@vchuravy](https://meta.discourse.org/u/vchuravy)
#### Post date: [June 30, 2017, 5:49am UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/50 "2017-06-30T05:49:02Z")

</div>

It would be great if we could use this transition as an opportunity to add correct rendering of mathematical equations. There is a common mark plugin to handle this [GitHub - classeur/markdown-it-mathjax: Markdown-it plugin to bypass LaTeX math for mathjax processing. · GitHub](https://github.com/classeur/markdown-it-mathjax)

---

<div class="post-metadata">

### Author: ![Stranik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stranik/32/85638_2.png) [@Stranik](https://meta.discourse.org/u/Stranik)
#### Post date: [June 30, 2017, 6:32am UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/51 "2017-06-30T06:32:13Z")

</div>

I don’t know here to write. In this topic. The problem with Russian tags. If the category slug is normally displayed as a link, then the Russian characters in tags - links are not.

 ![](https://global.discourse-cdn.com/meta/original/3X/0/7/0786fb7cebb1682fa5c04337d6df0955d679b9d3.jpg)

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [June 30, 2017, 10:16am UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/52 "2017-06-30T10:16:53Z")

</div>

That isn’t actually related to markdown-it, it is an existing issue

> [@How to make a hashed tag clickable in posts?](https://meta.discourse.org/t/how-to-make-a-hashed-tag-clickable-in-posts/50813):
>
> I saw somewhere that tags are clickable when in text. But mine is not: I haven’t found any relevant setting in the “Tags” section in Settings page. Am I missing something?

---

<div class="post-metadata">

### Author: ![Vitaly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vitaly/32/120475_2.png) [@Vitaly](https://meta.discourse.org/u/Vitaly)
#### Post date: [June 30, 2017, 1:54pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/53 "2017-06-30T13:54:21Z")

</div>

> I enabled the typographer here

Note, smartquotes can be done better. Ideally - with autoselecting proper characters, depending on used language. Existing implementation is a trade off between simplicity and value.

Correct implemenattion in JS will require a lot of unicode constants for language detect. That will make client code too big (read as “can be done on server side only”).

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 30, 2017, 2:02pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/54 "2017-06-30T14:02:35Z")

</div>

There is a mathjax plugin, though if you’re hosted here, that doesn’t help you.

---

<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: [June 30, 2017, 2:03pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/55 "2017-06-30T14:03:59Z")

</div>

We probably plan to add mathjax to business and up, just need to figure out how to make it light weight enough. After I am done implementing the bbcode plugin I will move to mathjax. Also katex is a reasonable middle-ground which I will explore.

---

<div class="post-metadata">

### Author: ![Vitaly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vitaly/32/120475_2.png) [@Vitaly](https://meta.discourse.org/u/Vitaly)
#### Post date: [June 30, 2017, 2:07pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/56 "2017-06-30T14:07:03Z")

</div>

> [@cpradio](#):
>
> That isn’t actually related to markdown-it, it is an existing issue

In 99.9% such issues are caused by poor languages support by native JS regexps.

[https://github.com/markdown-it/linkify-it/blob/master/lib/re.js](https://github.com/markdown-it/linkify-it/blob/master/lib/re.js) - this can be used as example of how to replace “ordinary” javascript regexps with proper black magic.

Since all required unicode constants already available via markdown-it / linkify-it, it should not be difficult to fix hashtag plugin.

---

<div class="post-metadata">

### Author: ![Vitaly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vitaly/32/120475_2.png) [@Vitaly](https://meta.discourse.org/u/Vitaly)
#### Post date: [June 30, 2017, 2:20pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/57 "2017-06-30T14:20:35Z")

</div>

Kick me, when you find good concept for math expressions. When i investigated this topic, i found 3 problems and postponed everything until better times:

1. No inline syntax (only block one) for math in commonmark
2. What dialect to use, how to select?
  - TeX is cool, but asciimath much more simple for ordinary users
  - How can user switch the dialect when asciimath is not enougth?

3. Custom fonts required. How to load those only when necessary.

---

<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: [July 6, 2017, 1:38am UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/58 "2017-07-06T01:38:59Z")

</div>

[somelink - Just another link on the internet | somelink](http://somelink.com/#test) ◀ fails cause of the tag category plugin

---

<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: [July 6, 2017, 9:37pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/59 "2017-07-06T21:37:09Z")

</div>

OK, I took a shot at the plugin.

> [@Discourse Math](https://meta.discourse.org/t/discourse-math-plugin/65770):
>
> discourse2Summary Discourse Math uses [MathJax](https://www.mathjax.org/) (default) or [KaTeX](https://katex.org/) to render maths in your Discourse forum.open_bookInstall Guide This plugin is bundled with Discourse core. There is no need to install the plugin separately. Enabling Math The Math plugin can be enabled from its settings, accessed from your admin/plugins page: [Math settings] Features Once enabled, you can render inline math by wrapping with a single $ like so: $E=mc^2$. You can render blocks of math…

For now:

1. I used `$` and the [jgm suggested heuristic](https://github.com/discourse/discourse-math/blob/master/spec/pretty_text_spec.rb#L33-L41) as to handle cases like `100$ + 200$`

2. I selected TeX cause that is what [math.stackexchange.com](http://math.stackexchange.com) seem to use so there is lots of prior art.

3. I embedded the fonts in the plugin, and [load on demand](https://github.com/discourse/discourse-math/blob/master/assets/javascripts/initializers/discourse-math.js.es6#L56-L64).

---

<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: [July 6, 2017, 9:45pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/60 "2017-07-06T21:45:58Z")

</div>

On Monday we (I) plan to deploy this change to the Standard Tier 🎊 🤩 🧚

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [July 6, 2017, 10:05pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/61 "2017-07-06T22:05:22Z")

</div>

Found a slightly weird thing - for some reason this doesn’t get recognised as a mention

```plaintext
This is a line of text
@sam

```

This is a line of text  
@sam

* * *

But this works fine

```plaintext
This is a line of text

@sam

```

This is a line of text

@sam

---

<div class="post-metadata">

### Author: ![Vitaly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vitaly/32/120475_2.png) [@Vitaly](https://meta.discourse.org/u/Vitaly)
#### Post date: [July 6, 2017, 10:48pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/62 "2017-07-06T22:48:41Z")

</div>

> [@sam](#):
>
> I used and the jgm suggested heuristic as to handle cases like 100 + 200$

Could you explain details, why `$inline$` syntax will have no conflicts?

- what if equation has `$` inside (as part of variable name, comment etc)?
- on [math.stackexchange.com](http://math.stackexchange.com) i’ve seen that all spaces are replaced with underlines in sources. Is this a mandatory requirement to avoid collisions?

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [July 7, 2017, 3:09am UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/63 "2017-07-07T03:09:58Z")

</div>

Yeah, that next line is impacting my plugin as well ☹

@sam, I do have another issue I’m struggling to work around. It seems markdown-it is only getting setup when the composer is open. My main plugin, is the checklist plugin. Everything works fine when the composer was opened and then closed (without refreshing the page)

Knowing that doesn’t probably make a lot of sense, here is a video of it  
[http://nimb.ws/UNn5gb](http://nimb.ws/UNn5gb)

The error I receive is

```
Error: Could not find module `pretty-text/engines/markdown-it/helpers` imported from `discourse/plugins/discourse-plugin-checklist/lib/discourse-markdown/checklist`
    at requireFrom (discourse-loader:128)
    at reify (discourse-loader:106)
    at mod.state (discourse-loader:163)
    at tryFinally (discourse-loader:30)
    at require (discourse-loader:162)
    at eval (pretty-text/engines/discourse-markdown-it:208)
    at Array.forEach ()
    at setup (pretty-text/engines/discourse-markdown-it:206)
    at buildOptions (pretty-text/pretty-text:93)
    at getOpts (discourse/lib/text:23)
```

What is mind-boggling is it works just fine once the composer is opened and then closed. It only fails to find said helper import if the composer is never opened (you don’t have to type anything in the composer either).

Here is the code I’ve come up with thus far.

> **[Comparing main...markdown-it · discourse/discourse-checklist](https://github.com/discourse/discourse-checklist/compare/markdown-it?expand=1)**
>
> A simple checklist rendering plugin for discourse. Contribute to discourse/discourse-checklist development by creating an account on GitHub.

The error is being generated from (which I did not alter for markdown-it – not sure I need to)  
[https://github.com/cpradio/discourse-plugin-checklist/blob/master/assets/javascripts/discourse/initializers/checklist.js.es6#L47](https://github.com/cpradio/discourse-plugin-checklist/blob/master/assets/javascripts/discourse/initializers/checklist.js.es6#L47)

**Edited:** Changed the video URL, as I didn’t realize the dev tools was not captured.

---

<div class="post-metadata">

### Author: ![barryvan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/barryvan/32/82635_2.png) [@barryvan](https://meta.discourse.org/u/barryvan)
#### Post date: [July 7, 2017, 4:17am UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/64 "2017-07-07T04:17:03Z")

</div>

> [@sam](#):
>
> I enabled the typographer here (with the site setting enable\_markdown\_typographer)

I’ve got to say that this is probably my absolute favourite improvement that this new engine brings – being able to use double hyphens to produce spaced en dashes is amazing.

Out of curiosity, why the decision to disable the typographer by default? Is it likely to cause issues in languages other than English? Or is it out of fear of breaking existing content on rebake? Given that Discourse is primarily about the reading experience, I think it’d be good to by default enable features like the typographer which improve legibility.

---

<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: [July 7, 2017, 4:28am UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/65 "2017-07-07T04:28:05Z")

</div>

We circled back on this, we may enable it by default in a few weeks, just living with it for a bit now

---

<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: [July 7, 2017, 2:07pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/66 "2017-07-07T14:07:26Z")

</div>

> [@Vitaly](#):
>
> what if equation has $ inside (as part of variable name, comment etc)?

you would escape it like so: `$\$a$`

> [@Vitaly](#):
>
> i’ve seen that all spaces are replaced with underlines in sources. Is this a mandatory requirement to avoid collisions?

I really do not think so, can you think of an example where this is needed?

---

<div class="post-metadata">

### Author: ![Vitaly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vitaly/32/120475_2.png) [@Vitaly](https://meta.discourse.org/u/Vitaly)
#### Post date: [July 7, 2017, 2:27pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/67 "2017-07-07T14:27:01Z")

</div>

> [@sam](#):
>
> I really do not think so, can you think of an example where this is needed?

No, i just seen something strange on math.stackexchange and asked question about reasons, because you have more experience in this area

---

<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: [July 7, 2017, 2:28pm UTC](https://meta.discourse.org/t/commonmark-testing-started-here/65121/68 "2017-07-07T14:28:25Z")

</div>

> [@Vitaly](#):
>
> more experience in this area

Very marginally, I have only been doing MathJax for a few days 🧙 😊

[Previous page](https://meta.discourse.org/t/commonmark-testing-started-here/65121.md?page=2)

[Next page](https://meta.discourse.org/t/commonmark-testing-started-here/65121.md?page=4)
