Skip to content

Commit

Permalink
resolves #2498 configure asciimath block to render as displaymath (PR #…
Browse files Browse the repository at this point in the history
…3192)

- use an AsciiMath postfilter hook to change the display property to block
  • Loading branch information
mojavelinux committed Mar 24, 2019
1 parent f60f280 commit 8fb2ace
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.adoc
Expand Up @@ -15,6 +15,10 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[

== Unreleased

Bug Fixes::

* customize MathJax (using a postfilter hook) to apply displaymath formatting to AsciiMath block (#2498)

Build / Infrastructure::

* bundle .yardopts in RubyGem (#3193)
Expand Down
8 changes: 8 additions & 0 deletions lib/asciidoctor/converter/html5.rb
Expand Up @@ -264,6 +264,14 @@ def convert_document node
},
TeX: {#{eqnums_opt}}
})
MathJax.Hub.Register.StartupHook("AsciiMath Jax Ready", function () {
MathJax.InputJax.AsciiMath.postfilterHooks.Add(function (data, node) {
if ((node = data.script.parentNode) && (node = node.parentNode) && node.classList.contains('stemblock')) {
data.math.root.display = "block"
}
return data
})
})
</script>
<script src="#{cdn_base_url}/mathjax/#{MATHJAX_VERSION}/MathJax.js?config=TeX-MML-AM_HTMLorMML"></script>)
end
Expand Down

0 comments on commit 8fb2ace

Please sign in to comment.