# Mathematics extension

**URL:** <https://talk.commonmark.org/t/mathematics-extension/457>\
**Category:** Extensions\
**Created:** [September 6, 2014, 10:29pm UTC](https://talk.commonmark.org/t/mathematics-extension/457 "2014-09-06T22:29:39Z")\
**Posts on this page:** 1\
**Showing post:** 31

<div class="post-metadata">

**Author:** ![xoofx](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/xoofx/32/1424_2.png) [@xoofx](https://talk.commonmark.org/u/xoofx)\
**Post date:** [March 26, 2016, 2:05am UTC](https://talk.commonmark.org/t/mathematics-extension/457/31 "2016-03-26T02:05:07Z")

</div>

I have implemented parsing math inline of `$...$` and `$$...$$` and I followed mostly how parsing is done for emphasis delimiters, but I’m not really convinced this is the best way to do it. I would in fact expect `$...$` and `$$....$$` to work a bit like a string with quotes (but would just allow escape with `\$`).

But looking at pandoc for example, with the following [case](http://johnmacfarlane.net/babelmark2/?text=This+is+a+test+%24%24this+is+a+test%24):

```auto
This is a test $$this is a test$

```

it is generating this:

```auto
<p>This is a test <span class="math inline">\($this is a test\)</span></p>

```

Unlike delimiters, I would expect that a `$$` should match an ending `$$`

I’m not sure how Latex behaves with this. Is this the way it is usually handled?

---

_[View the full topic](https://talk.commonmark.org/t/mathematics-extension/457)._
