Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Talk on emptyline support in Display LaTex #1004

Closed
minghu6 opened this issue Jul 1, 2020 · 4 comments
Closed

Talk on emptyline support in Display LaTex #1004

minghu6 opened this issue Jul 1, 2020 · 4 comments
Labels
T: support Support request.

Comments

@minghu6
Copy link

minghu6 commented Jul 1, 2020

Ref the issue Python-Markdown/markdown#993

Alternative Math Blocks is great, but it's also a workaround for display latex with emptyline.

The finally target for me is rendering the markdown file compatiable with Typora(it support emptyline in dispaly LaTex), so I can use it write markdown file and don't have to remember to modified the synax from top to bottom for Python's mkdocs every time.

@gir-bot gir-bot added the S: triage Issue needs triage. label Jul 1, 2020
@facelessuser
Copy link
Owner

facelessuser commented Jul 1, 2020

Understood, but I will explain why I have made these decisions:

  1. Python Markdown has some weaknesses in its parsers. It is why the official fenced code block extension isn't supported in nested structures such as lists. That is why I wrote SuperFences. If you look at the code of SuperFences, you will see it is pretty complicated as I had work around some of the parsers weakness to get it working properly in nested environments. I won't go into the details, but it was complicated.

  2. Because of (1) Arithmatex chose to implement block math by identifying paragraphs that were wrapped in one of the configured tokens, in this case, we are talking about $$. This is to avoid doing all the complex work we do in SuperFences.

  3. As I found it would be useful to allow a little bit more flexibility, I used the custom fence feature I implemented in SuperFences to implement GitLab style math blocks, which is the alternate syntax.

Because of (1) and the fact that I do not wish to do all of SuperFence's complicated logic to implement block math (as stated in (2)), I have chosen (3) to be an acceptable path that I am currently willing to implement.

My goal is not to implement compatibility between different parsers. I am sorry if you wish I could support full compatibility, but I do not have the time or motivation to do so. If I support compatibility in Typora, I'm sure I'll then get requests to ensure compatibility for some other parser. I cannot match compatibility with all parsers.

If at some future point, Python Markdown handling of fenced styled document patterns improves, I may reconsider, but right now, SuperFences is the only extensions I am willing to support that requires such complicated workarounds.

@minghu6
Copy link
Author

minghu6 commented Jul 1, 2020

Got it, I think Waylan maybe feel headache to rewrite blockprocessors, since it maybe caused refactor of core logic. 😄

@facelessuser
Copy link
Owner

The big issue is definitely how block processors work. The way the blocks are broken up and processed make it difficult. I tried to implement fenced code blocks via a block processor early on, but when you get into lists, it is difficult to get all the pieces when there are new lines. And multiple consecutive new lines get reduced to a single new line which just isn't acceptable for for raw code blocks. Preprocessors was the only real, acceptable approach without rewriting a lot of the code.

@facelessuser
Copy link
Owner

@gir-bot remove S: triage
@gir-bot add T: support

@gir-bot gir-bot added T: support Support request. and removed S: triage Issue needs triage. labels Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: support Support request.
Projects
None yet
Development

No branches or pull requests

3 participants