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

Improve MathML examples #36925

Merged
merged 3 commits into from
Nov 28, 2024
Merged

Improve MathML examples #36925

merged 3 commits into from
Nov 28, 2024

Conversation

pepelsbey
Copy link
Member

@pepelsbey pepelsbey commented Nov 22, 2024

Description

  • Adds a short intro explaining the example.
  • Uses Playground and shows the code.
  • Highlights the steps with comments.
  • Uses font-size: smaller for inline annotations (it nicely aligns with the \small key in TeX).
  • Adds TeX annotations.

Motivation

To make examples more useful and allow playing with them.

@pepelsbey pepelsbey requested a review from a team as a code owner November 22, 2024 14:40
@pepelsbey pepelsbey requested review from fred-wang and removed request for a team November 22, 2024 14:40
@github-actions github-actions bot added Content:MathML MathML docs size/m [PR only] 51-500 LoC changed labels Nov 22, 2024
Copy link
Contributor

github-actions bot commented Nov 22, 2024

Preview URLs

External URLs (4)

URL: /en-US/docs/Web/MathML/Examples/Deriving_the_Quadratic_Formula
Title: Deriving the Quadratic Formula


URL: /en-US/docs/Web/MathML/Examples/MathML_Pythagorean_Theorem
Title: Proving the Pythagorean theorem

(comment last updated: 2024-11-27 11:48:25)

<!-- Representation in TeX format -->
<annotation encoding="application/x-tex">
\begin{aligned}
ax^2 + bx + c &= 0 \\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should use &amp;, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that it’s not rendered and you’re supposed to copy-paste it from the source, it might be better to store TeX annotations as they are. Otherwise, it would be hard to reproduce MathML with them, especially the bigger ones. Not sure why GitHub is concerned with naked &: browsers render it just fine, and the HTML validator doesn’t mind it either.

<!-- Representation in TeX format -->
<annotation encoding="application/x-tex">
\begin{aligned}
(a + b)^2 &= c^2 + 4 \cdot \left( \frac{1}{2} ab \right) \\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@pepelsbey pepelsbey Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are only two cases in annotations: & and &=, surrounded by spaces. So it should be fine then. Thanks!

@fred-wang fred-wang self-requested a review November 28, 2024 08:37
@pepelsbey pepelsbey merged commit e6e9826 into mdn:main Nov 28, 2024
8 checks passed
@pepelsbey pepelsbey deleted the math-examples branch November 28, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:MathML MathML docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants