lzanini/mdbook-katex

Accessibility by including MathML

hwf1324 opened this issue · 12 comments

Without Mathml, KaTeX content on HTML cannot be read using a screen reader.

Could you elaborate on that?

I don't speak English, the following is translated from Deepl.

I see that KaTeX has both HTML and Mathml output in the output options section. At the moment maybe only the HTML output is available, because the screen reader can't access the math content there.

output: string. Determines the markup language of the output. The valid choices are:

  • html: Outputs KaTeX in HTML only.
  • mathml: Outputs KaTeX in MathML only.
  • htmlAndMathml: Outputs HTML for visual rendering and includes MathML for accessibility. This is the default.

Please directly state your intention. And, speak the language you speak and let me translate it.

Ok.

使用 mdbook-katex 渲染出来的数学内容不能被 NVDA(屏幕阅读器)+ Access8Math 插件所访问。我希望它可以支持无障碍。

我认为 KaTeX 是支持无障碍的,而它使用的方法应该是在渲染 HTML 的同时也提供 Mathml 给屏幕阅读器使用。

目前 mdbook-katex 渲染出来的好像只有 HTML 内容。

Do you mean supporting visually-impaired users by including MathML in the rendered HTML?

是的,例如在 katex.org 上的示例中的那样,katex 同时包含 katex-mathml 和 katex-html。

感谢!

Could you provide a link to the example with HTML and MathML?

I have no idea how people in need use these accessibility features. Any hint is welcomed.

Could you provide a link to the example with HTML and MathML?

是的,我想 https://katex.org/ 上的 Demo 就满足这个要求。

您好!我有一个猜测,在 src/lib.rs:230 处的 build_opts 函数里:

.output_type(katex::OutputType::Html)

And
.output_type(katex::OutputType::Html)

不知道是否可以把 Html 改为 HtmlAndMathml 来简单修复这个问题?

如果有机会,我想我会尝试一下,但不确定它是否会破坏其它事物。

感谢!

Supported in v0.3.1.
You need a book.toml that looks like this:

[output.katex]

[preprocessor.katex]
output = "htmlAndMathml"
renderer = ["html"]