asciidoctor / asciidoctor-mathematical

An extension for Asciidoctor that converts the content of STEM blocks and inline macros using Mathematical.
MIT License
50 stars 45 forks source link

AsciiMath support #79

Closed GarkGarcia closed 4 years ago

GarkGarcia commented 4 years ago

AsciiMath support is now viable via the recently integrated LaTeX backend of asciidoctor/asciimath! Rendering AsciiMath blocks should now be as simple as transpiling the block to LaTeX and rendering it with Mathematical.

The only LaTeX command outputted by asciidoctor/asciimath which is not currently supported by Mathematical is \twoheadrightarrowtail. Solutions to this issue are discussed in https://github.com/asciidoctor/asciimath/pull/17#issuecomment-621939890 and https://github.com/asciidoctor/asciimath/pull/17#issuecomment-622411392.

ProgramFan commented 4 years ago

A PR is welcome.

GarkGarcia commented 4 years ago

Could you help me figuring out which is the relevant section for this fix? Where are AsciiMath blocks processed?

ProgramFan commented 4 years ago

The regex to parse inline stem is at https://github.com/asciidoctor/asciidoctor-mathematical/blob/f81c3a0d3e4ea9fe10fa223010267b1239a030e5/lib/asciidoctor-mathematical/extension.rb#L9. You need to add one more for asciimath.

You need to handle asciimath stem blocks here at https://github.com/asciidoctor/asciidoctor-mathematical/blob/f81c3a0d3e4ea9fe10fa223010267b1239a030e5/lib/asciidoctor-mathematical/extension.rb#L72.

You need to handle asciimath inline macros here at https://github.com/asciidoctor/asciidoctor-mathematical/blob/f81c3a0d3e4ea9fe10fa223010267b1239a030e5/lib/asciidoctor-mathematical/extension.rb#L127.

The above three places shall be enough for asciimath support.

GarkGarcia commented 4 years ago

Alright. As soon as the new version of asciimath get's released I'll work on this changes (I've just realized the changes were merged to the masterbranch but they haven't being released to RubyGems yet).

ProgramFan commented 4 years ago

Thanks for your contribution.

GarkGarcia commented 4 years ago

Fixed on https://github.com/asciidoctor/asciidoctor-mathematical/commit/d82041ddce64ea6014f3f3d613f3d5e6c4d257d3.