Skip to content

math option in RenderOptions #8

Description

@tani

Describe the feature

It would be nice to introduce support for custom math rendering via a new math option in RenderOptions. This allows users to intercept and replace LaTeX math spans (both inline and display) with any custom string (e.g., KaTeX/MathJax rendered HTML or specific ANSI sequences for terminal).

const html = await renderToHtml("This is $E=mc^2$", {
  math: (code, display) => {
    return display 
      ? `<div class="math-display">${render(code)}</div>` 
      : `<span class="math-inline">${render(code)}</span>`;
  }
});

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions