facelessuser / MarkdownPreview

Markdown preview and build plugin for Sublime Text https://facelessuser.github.io/MarkdownPreview/
Other
405 stars 53 forks source link

math formulas display problem #103

Closed JingwangLi closed 4 years ago

JingwangLi commented 4 years ago

I found you must insert a blank line between formulas and other part to keep formulas display normally, otherwise it will look bad, like this:

Similarly, we can have
$$\frac{f(x)-f(s)}{x-s}\le \frac{f(u)-f(s)}{u-s}\le\frac{f(u)-f(x)}{u-x}$$

image

But inserting a blank line will make every formula become a single paragraph with a bigger vertical spacing which is not expected.

Can I configure something to fix this problem?

facelessuser commented 4 years ago

Please read the documentation on this: https://facelessuser.github.io/pymdown-extensions/extensions/arithmatex/#input-format

If you are using block format, you need to have a new line before the block, if you want inline format, you need to use the appropriate inline syntax. This is all covered in the docs. Let me know if there is something specific you are confused about.

JingwangLi commented 4 years ago

Thank you, I already read the document. There are too many different specifics... Some of them needn't insert newline before the formulas block and I have been used to that unfortunately. The document said A block should be both preceded and followed by an empty line, I wonder that whether it will cause some conflicts if I revise pymdownx.arithmatex to make a block needn't be preceded and followed by an empty line? Specificly, A block should be both preceded and followed by an empty line is only a specific or is used to avoid some problems?

facelessuser commented 4 years ago

This was basically discussed in the last issue. The Markdown spec separates blocks by blank lines. Python Markdown is implemented in such a way that the only way to use the block parser is to adhere to this rule. You can circumvent this by using a preprocessor parser, but you create a ton of additional complexity.

This is no different than how lists, paragraphs and other blocks work in Python Markdown.

Math must be contained in it's own block when using block format, that will not change, regardless of what may out may not be possible in some other Markdown parser. The only way this would potentially change is if Python Markdown some how fundamentally changed how it processed blocks.

facelessuser commented 4 years ago

As things stand now, Arithmatex works as expected.

@gir-bot remove S: triage @gir-bot add S: wontfix

facelessuser commented 4 years ago

Also, in the future, any issues with 3rd party libraries should be filed in the appropriate 3rd party library's issue tracker.

JingwangLi commented 4 years ago

Ok, thank you!