Skip to content

MathJax styling of dynamic content @content #4499

@lukasberbuer

Description

@lukasberbuer

Describe the bug

If dynamic content contains a MathJax block formula $$ ... $$, it is styled differently than in a static markdown file:

  • Static content:
    style="direction: ltr; display: block; text-align: center; margin: 1em 0px; position: relative;"
  • Dynamic content with <!-- @content -->:
    style="direction: ltr; position: relative;"

So the dynamic MathJax formula is not displayed as a block and not centered. Any ideas why?

Image

Reproduction

Code

math-[id].md:

## Static content

$$
a^2 + b^2 = c^2
$$

## Dynamic content via @content

<!-- @content -->

math-[id].paths.ts:

const content = `
$$
a^2 + b^2 = c^2
$$
`;

export default {
  paths() {
    return [{ params: { id: "pythagoras" }, content: content }];
  },
};

Expected behavior

Same styling of static and dynamic content.

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 7 PRO 7840U w/ Radeon 780M Graphics  
    Memory: 15.70 GB / 30.67 GB
  Binaries:
    Node: 22.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.99)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    vitepress: ^1.5.0 => 1.5.0

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions