w3c / w3c/mathml-core

[interop] Text fragments + MathML

Open
#240 4 comments 1 reaction 1 assignee View on GitHub

@bkardell is already working on this.

Since Aug 25, 2025.

Dominant language
HTML
Stars
56
Forks
20
PR merge metrics
No merged PRs in 30d

Description

The URL Fragment Text Directives effort defines an algorithm "find a range from a text directive" which is applicable over <math> nodes. I find the following quote to be a great summary:

The basic premise of this algorithm is to walk all searchable text nodes within a block, collecting them into a list. The list is then concatenated into a single string in which we can search, using the node list to determine offsets with a node so we can return a range.

I am opening this issue to discuss if "a block" is a concept that needs to be extended/refined when that algorithm is executed inside a <math> context.

This could be a very useful refinement, as linking to math-rich fragments is often appropriate when discussing scientific materials.

If there is interest, we can open a mirror issue in the WICG/scroll-to-text-fragment repository. I have checked all repositories for related issues - as far as I am aware this question not been discussed before.


Examples

Successful

Text fragments are available in chromium browsers, where they also match text nodes inside MathML. I will add 3 examples with screenshots.

  1. Link to token element, first instance of <mi>ℝ</mi>

  2. Link to a textual fragment inside <mtext>

  3. Link to a range, starting at the first <mi>det</mi> determinant, and upto the end of the closing ) for its matrix.

Unsuccessful
  1. Link to text nodes in adjacent token elements (grandchildren in the same <mrow>), fails.

  2. Link to adjacent HTML text node and adjacent inline math <mi>, fails

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.