jelovirt / org.lwdita

LwDITA parser for DITA-OT
http://lwdita.org/
Apache License 2.0
25 stars 19 forks source link

Publishing Failed with Markdown Docs where Formula is in use #181

Closed dcwise closed 1 year ago

dcwise commented 1 year ago

Hi there, We run into a problem when publishing Markdown documents using the Oxygen-enabled DITA OT. Specifically, in case there are formula in use as shown below,publishing always fails. Use Case 1

功能

$$ y = \frac{e^{x} - e^{-x}}{e^{x} + e^{-x}} $$ 图片

Use Case 2

功能

$$ Y[n_i][c_j][yh_m][ywn] = \max^{kh-1}{h=0} \max^{kw-1}_{w=0} X[n_i][c_j][sh yh_m + h][sw yw_n + w] $$

二维最大池化正向传播过程。根据输入、池化核、步长(stride)等参数计算输出特征图的大小,NCHW数据格式可用以上公式表示。

image

Please can you advise how to make this embeded Latex work from within Markdown documents so that the DITA OT enabled publishing will work without a problem?

dcwise commented 1 year ago

Further to my last message, It was this line thrown by the DITA OT process as follows: "no render configured for vladsch.flexmark.superscript.Superscript" that led to the publishing failure.

jelovirt commented 1 year ago

LwDITA Markdown doesn't support LaTeX extension for input or output. That LaTeX uses a ^ character that is interpreted as a superscript delimiter. LwDITA Markdown support superscript, but maybe file is parsed as MDITA that doesn't.

jelovirt commented 1 year ago

It's very unlikely that support for LaTeX will be added, because the underlying Markdown parser doesn't have an extension for it, and we would need to convert LaTeX into MathML.

raducoravu commented 1 year ago

@jelovirt maybe the processing could attempt to just extract the Latex code and generate a DITA "foreign" element containing it with a certain outputclass attribute, in this way a simple publishing plugin like this one could process it further in the publishing stages: https://blog.oxygenxml.com/topics/adding-latex-equation-support-dita.html Looking at the wiki for flexmark: https://github.com/vsch/flexmark-java/wiki/Extensions they seem to have some support for this in GitHub flavored markdown:

Math, inline via $``$ or as fenced code with math info string requiring inclusion of Katex in the rendered HTML page.
raducoravu commented 1 year ago

@jelovirt any feedback for my previous remark? How about if we would use the "GitLabExtension" when parsing with flexmark?

dcwise commented 1 year ago

GitLab actually does a better job when parsing a Latex enabled expression.

On 7/3/23, Radu Coravu @.***> wrote:

@jelovirt any feedback for my previous remark? How about if we would use the "GitLabExtension" when parsing with flexmark?

-- Reply to this email directly or view it on GitHub: https://github.com/jelovirt/org.lwdita/issues/181#issuecomment-1617451832 You are receiving this because you authored the thread.

Message ID: @.***>

-- Keep an Exacting Eye for Detail

raducoravu commented 8 months ago

GitHub also has support for embedding Latex equations in markdown: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions