Skip to content

Add support for LaTeX / MathJax when rendering Markdown #150

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

Closed
xjl456852 opened this issue May 30, 2024 · 13 comments
Closed

Add support for LaTeX / MathJax when rendering Markdown #150

xjl456852 opened this issue May 30, 2024 · 13 comments
Assignees
Labels
feature request Enhancement or feature request implemented The initial implementation is done waiting-for-a-reply Waiting for a reply or clarification from the submitter of the issue

Comments

@xjl456852
Copy link

Now the algernon not support markdown latex.
image

Can markdown latex be supported
thank you!

@xyproto
Copy link
Owner

xyproto commented May 30, 2024

Thanks for the feature request! I will see if I can find a Go module that supports it.

@xyproto xyproto added the feature request Enhancement or feature request label May 30, 2024
@xyproto
Copy link
Owner

xyproto commented May 31, 2024

I added support for this.

If you clone the repo, build with go build -mod=vendor and then run ./welcome.sh or ./welcome.bat (depending on your system), then the "Mathematical Formulas" example demonstrates the use.

Please confirm that it is working.

@xyproto xyproto self-assigned this May 31, 2024
@xyproto xyproto added waiting-for-a-reply Waiting for a reply or clarification from the submitter of the issue implemented The initial implementation is done labels May 31, 2024
@xjl456852
Copy link
Author

I have tested the latest version. maybe cann't work. the table also can't work.
but when I delete any text block, latex can work , but the table always cann't work.

the test.md

test.md

image

thank you .

@xyproto
Copy link
Owner

xyproto commented Jun 4, 2024

It is the text at the end that stops the formulas from working, and not the tables:

```text
any text
```

I am in the process of figuring out why.

@xyproto
Copy link
Owner

xyproto commented Jun 4, 2024

There is a bug in https://github.com/xyproto/splash where it is confused if there is both blocks of code and also MathJax output.

@xyproto xyproto added bug This is a bug and removed waiting-for-a-reply Waiting for a reply or clarification from the submitter of the issue labels Jun 4, 2024
@xyproto
Copy link
Owner

xyproto commented Jun 4, 2024

I fixed this issue in the main branch. Please test.

@xyproto xyproto added waiting-for-a-reply Waiting for a reply or clarification from the submitter of the issue can-reproduce-the-issue Can reproduce the issue and removed bug This is a bug can-reproduce-the-issue Can reproduce the issue labels Jun 4, 2024
@xjl456852
Copy link
Author

xjl456852 commented Jun 4, 2024

hello, I test the least version.

It also has two problems.

1.The table is no border.

image

2. The mathjax plugin lost four woff files.

the woff path is the same. like this.
image
image
image

It looks like this
image

When I create the path(output/chtml/fonts/woff-v2) in the samples, and copy the worf from other software, It works fine

image
image
image

@xyproto
Copy link
Owner

xyproto commented Jun 4, 2024

Thanks for the feedback! I changed the MathJax rendering to output SVG instead of HTML, which I hope will fix the woff font issue.

Why the borders are missing is a mystery to me. They look fine here:

bilde

I made the borders for the default theme just a bit thicker, just in case it makes it work on your end.

Please test. Thank you.

@xjl456852
Copy link
Author

The formulas are now displayed correctly, but the table still has no borders.
image

@xyproto
Copy link
Owner

xyproto commented Jun 4, 2024

That is curious.

Are you opening the markdown file with algernon -m file.md and then viewing the result in a browser like Firefox or Chromium?

Which OS, Browser and command for launching Algernon are you using?

@xjl456852
Copy link
Author

xjl456852 commented Jun 4, 2024

My OS is windows 11.
My browser is Edge.
When I put the test.md file in to the algernon main directory, the table has borders. but When I put the test.md file in to the algernon/samples directory, the table has no borders.

I used double click algernon.exe , double click welcome.bat, algernon -m file.md, and algernon -m dir\file.md to test it.

For example I used double click algernon.exe to start server:
Test.md in the algernon main directory:
image

Test.md in the algernon/samples directory:
image

I found anther bug.

I modified the test.md to test1.md.
When the md has two same picture links, algernon -m file.md this command can't to used, it can't open browser, and the process can't to load. (Using this command to run the test.md is normal).
image

You can download this test1.zip, and unzip it to test algernon -m file.md command.

test1.zip

@xyproto
Copy link
Owner

xyproto commented Jun 4, 2024

Thanks for the reply! I moved the table border issue here: #151

I am closing this feature request, since MathJax support has now been added.

@xyproto xyproto closed this as completed Jun 4, 2024
@xjl456852
Copy link
Author

I updated the test1.zip file

@xyproto xyproto changed the title Can markdown latex be supported Add support for LaTeX / MathJax when rendering Markdown Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Enhancement or feature request implemented The initial implementation is done waiting-for-a-reply Waiting for a reply or clarification from the submitter of the issue
Projects
None yet
Development

No branches or pull requests

2 participants