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

Standardizing the use of Markdown and LaTeX for the documentation layer #3636

Open
casella opened this issue Jan 15, 2025 · 7 comments · May be fixed by #3643
Open

Standardizing the use of Markdown and LaTeX for the documentation layer #3636

casella opened this issue Jan 15, 2025 · 7 comments · May be fixed by #3643

Comments

@casella
Copy link
Collaborator

casella commented Jan 15, 2025

Follow up of modelica/ModelicaStandardLibrary#3122 in the proper place, i.e., MAP-Lang:

Regarding OpenModelica I'm a bit hesitant at investing resources to implement a feature that is not standardized, just by reverse-engineering other tools. But I am definitely in favour of adding this feature to the standard, and I would definitely go ahead with the implementation and with an MCP if there is some consensus that this should be standardized. That would also provide two test implementations, which I understand is a (de-facto?) requirement for adding two language feature to the spec.

What do the other tool vendors think? I guess DS is fine with that, since they implemented it already. What about Wolfram, MapleSoft, and ESI?

@henrikt-ma
Copy link
Collaborator

General LaTeX support sounds very scary, but what about KaTeX, would it be considered mature, maintained and stable enough for the Modelica specification to depend upon? License concerns?

Markdown would be handy, but then we would need to agree on some dialect, which needs to be stable and come with a maintained and generously licensed implementation. What are the options?

@SG-phimeca
Copy link

For our part, using something significantly different than what Dymola uses would be a showstopper.
We want our documentation annotation to be supported at least OpenModelica and Dymola.

We switch from LaTeX to markdown some years ago (relying on pandoc) for most usages to accomodate more people. LaTeX is astounding and I love it, but it is esoteric.

Markdown (any reasonably well spread dialect would do for my part) could a be a low common denominator. Aren't we writing in markdown right here?

Markdown is used for readme on git repositories, to write documentation with Sphinx increasingly often as a replacement for cumbersome reST, as well as many popular tools such as Notion or Obsidian.

There are diverse specifications of Markdown, with first “vanilla markdown”: https://daringfireball.net/projects/markdown/. As far as I am concern, required features include:

  • title (with # syntax)

  • italic (italic) and bold (bold)

  • cross reference

  • figure with caption

  • math (latex like ; main issue: choose the delimiter consistantly with Dymola at least)

  • possibly: tables (can be bothering)

The rest would be considered bonus.

@j-emils
Copy link

j-emils commented Jan 17, 2025

For our part, using something significantly different than what Dymola uses would be a showstopper. We want our documentation annotation to be supported at least OpenModelica and Dymola.

We switch from LaTeX to markdown some years ago (relying on pandoc) for most usages to accomodate more people. LaTeX is astounding and I love it, but it is esoteric.

Markdown (any reasonably well spread dialect would do for my part) could a be a low common denominator. Aren't we writing in markdown right here?

Markdown is used for readme on git repositories, to write documentation with Sphinx increasingly often as a replacement for cumbersome reST, as well as many popular tools such as Notion or Obsidian.

There are diverse specifications of Markdown, with first “vanilla markdown”: https://daringfireball.net/projects/markdown/. As far as I am concern, required features include:

  • title (with # syntax)
  • italic (italic) and bold (bold)
  • cross reference
  • figure with caption
  • math (latex like ; main issue: choose the delimiter consistantly with Dymola at least)
  • possibly: tables (can be bothering)

The rest would be considered bonus.

Well said, totally agree!

@HansOlsson
Copy link
Collaborator

We will have to investigate exactly what Markdown extensions Dymola uses ( @DagBruck ). As I see the main benefit it is quick and works for simple documentation - without having to use a specialized editor.

For LaTeX it is display math, e.g.,

$$
x=\sqrt(x)
$$

Not because LaTeX math is the easiest to read and write, but because there's no viable alternative.

@DagBruck
Copy link
Collaborator

To my knowledge Dymola supports the GitHub dialect of Markdown. (We haven't implemented it ourselves, but that is what the toolkit documentation says.)

@HansOlsson
Copy link
Collaborator

HansOlsson commented Jan 24, 2025

Note that GitHub isn't good at documenting their Markdown.

The formal specification they link to is: https://github.github.com/gfm/ from 2019, and then Math was added in 2022 https://github.blog/news-insights/product-news/math-support-in-markdown/ with separate documentation https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions

Test from blog:

When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$

Note that the latter (directly copied from the blog!) doesn't work in GitHub, it should be $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$

And two variants from doc:

The Cauchy-Schwarz Inequality
$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$

The Cauchy-Schwarz Inequality

$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$

Unfortunately Dymola 2025x only support display math, not inline math or math-language. On the other hand without the weird white-space issue for display math.

Conclusion: I would just specify GitHub flavored Markdown with display math; and hope that tools will be more consistent.

@Sonyoyo
Copy link

Sonyoyo commented Jan 24, 2025

Inline math works in Dymola with the following syntaxe :

Inline equation → \\\\(W_{TH}=\\alpha S(T_1-T_2)\\\\)

@HansOlsson HansOlsson linked a pull request Jan 24, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants