Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Add option to disable inline math #28

Merged
merged 3 commits into from
Oct 11, 2018
Merged

Add option to disable inline math #28

merged 3 commits into from
Oct 11, 2018

Conversation

morganwillcock
Copy link
Contributor

This adds the sphinx option m2r_disable_inline_math and the cli option --disable-inline-math.

Previously there was no way to disable interpreting anything between two $ characters as math. An example of a problematic document is something like this, where we are having rendering issues due to the inline math parsing being triggered by page content.

I've not really looked at anything similar before, so feel free to edit or reject for a different approach.

Thanks!

@codecov-io
Copy link

codecov-io commented Aug 28, 2018

Codecov Report

Merging #28 into master will increase coverage by 0.09%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   96.16%   96.25%   +0.09%     
==========================================
  Files           3        3              
  Lines         756      775      +19     
==========================================
+ Hits          727      746      +19     
  Misses         29       29
Impacted Files Coverage Δ
tests/test_cli.py 95.68% <100%> (+0.31%) ⬆️
m2r.py 93.51% <100%> (+0.14%) ⬆️
tests/test_renderer.py 99.1% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e88a711...fdf0c64. Read the comment docs.

@adeelsohailahmed
Copy link

Hey @miyakogi, why don't you check out this awesome pull request by morganwillcock? It fixes a fundamental issue.

@miyakogi
Copy link
Owner

Sorry for late response.
I was wondering this may be a specific use case.
But some people agree this PR, I decided to merge this.
Thank you for nice code and tests!

@miyakogi miyakogi merged commit 69d92e1 into miyakogi:master Oct 11, 2018
@morganwillcock morganwillcock deleted the no-maths branch October 13, 2018 17:43
@kalvdans
Copy link

I suggest we remove support for inline math using

`$ a=b $`

and replace it with

$` a=b `$

and revert this PR, since the flag is not needed anymore. I've posted issue CrossNox#20 about it.

@morganwillcock
Copy link
Contributor Author

The use case isn't for how to use inline math, it is how to work around valid Markdown (the specification for which has no concept of inline math) being interpreted as inline math. This option is effectively an extension which indirectly creates a Markdown derivative, so there should be an option to control whether it is active.

A good modification might be one that allowed you to specify the inline math style that you wanted to use, as well as turn it off.

@kalvdans
Copy link

I agree, given the plethora of syntaxes discussed at https://talk.commonmark.org/t/mathjax-extension-for-latex-equations/698 . The first step is to remove the current syntax and the flag though, to prepare for adding another option that specifies the inline math style.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants