Skip to content

Commit

Permalink
Extensions: Add Ext_tex_math_gfm constructor to Extension.
Browse files Browse the repository at this point in the history
[API change]

This handles two GitHub-specific syntaxes for math.

And document in MANUAL.txt.

This is now default for `gfm`, in addition to `tex_math_dollars`.

See #9121.
  • Loading branch information
jgm committed Oct 24, 2023
1 parent 7115edf commit e021968
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions MANUAL.txt
Expand Up @@ -3405,6 +3405,7 @@ Emojis are replaced by their names.
## Math Input

The extensions [`tex_math_dollars`](#extension-tex_math_dollars),
[`tex_math_gfm`](#extension-tex_math_gfm),
[`tex_math_single_backslash`](#extension-tex_math_single_backslash), and
[`tex_math_double_backslash`](#extension-tex_math_double_backslash)
are described in the section about Pandoc's Markdown.
Expand Down Expand Up @@ -5766,6 +5767,19 @@ Asian wide characters and other characters.

Parses textual emojis like `:smile:` as Unicode emoticons.

#### Extension: `tex_math_gfm` ####

Supports two GitHub-specific formats for math.
Inline math: ``$`e=mc^2`$``.

Display math:

````
``` math
e=mc^2
```
````

#### Extension: `tex_math_single_backslash` ####

Causes anything between `\(` and `\)` to be interpreted as inline
Expand Down
3 changes: 3 additions & 0 deletions src/Text/Pandoc/Extensions.hs
Expand Up @@ -133,6 +133,7 @@ data Extension =
| Ext_task_lists -- ^ Parse certain list items as task list items
| Ext_table_captions -- ^ Pandoc-style table captions
| Ext_tex_math_dollars -- ^ TeX math between $..$ or $$..$$
| Ext_tex_math_gfm -- ^ Additional TeX math style used in GFM
| Ext_tex_math_double_backslash -- ^ TeX math btw \\(..\\) \\[..\\]
| Ext_tex_math_single_backslash -- ^ TeX math btw \(..\) \[..\]
| Ext_wikilinks_title_after_pipe -- ^ Support wikilinks of style
Expand Down Expand Up @@ -398,6 +399,7 @@ getDefaultExtensions "gfm" = extensionsFromList
, Ext_yaml_metadata_block
, Ext_footnotes
, Ext_tex_math_dollars
, Ext_tex_math_gfm
]
getDefaultExtensions "commonmark" = extensionsFromList
[Ext_raw_html]
Expand Down Expand Up @@ -551,6 +553,7 @@ getAllExtensions f = universalExtensions <> getAll f
, Ext_hard_line_breaks
, Ext_smart
, Ext_tex_math_dollars
, Ext_tex_math_gfm
, Ext_superscript
, Ext_subscript
, Ext_definition_lists
Expand Down

0 comments on commit e021968

Please sign in to comment.