Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

MathJax styling of dynamic content @content #4499

Closed
4 tasks done
lukasberbuer opened this issue Jan 20, 2025 · 2 comments
Closed
4 tasks done

MathJax styling of dynamic content @content #4499

lukasberbuer opened this issue Jan 20, 2025 · 2 comments

Comments

@lukasberbuer
Copy link

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

@lukasberbuer lukasberbuer added the bug: pending triage Maybe a bug, waiting for confirmation label Jan 20, 2025
@brc-dd brc-dd removed the bug: pending triage Maybe a bug, waiting for confirmation label Jan 20, 2025
@brc-dd brc-dd closed this as completed in e812916 Jan 20, 2025
@brc-dd
Copy link
Member

brc-dd commented Jan 20, 2025

It'll be there in next release. You can use nightly releases for now:

npm i https://pkg.pr.new/vitepress@e812916

@lukasberbuer
Copy link
Author

Wow, that was fast. Thank you @brc-dd!

lukasberbuer added a commit to openae-io/openae-io that referenced this issue Jan 20, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2025
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants