Skip to content

Docusaurus v3 not invoking rehype plugins during build #9361

@johnnyreilly

Description

@johnnyreilly

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

I've written a number of rehype plugins for Docusaurus which I use on my blog. Here's a screenshot of https://johnnyreilly.com/azure-open-ai-generate-article-metadata-with-typescript with devtools open. Notice the <img loading="eager" fetchpriority="high" alt="..." src="..." width="800" height="450" class="img_CujE"> image tag. The loading="eager" and fetchpriority="high" are a result of the rehype plugin:

image

I've migrated the rehype plugin across to Docusaurus v3. However, the plugin is not invoked for the server build - only the client.

Reproducible demo

johnnyreilly/blog.johnnyreilly.com#712

Steps to reproduce

Look at the build in the pull request. If you clone that repo and checkout the docusaurus3-beta branch you can reproduce this by:

cd blog-website
yarn
yarn build

Expected behavior

We would end up with a build which demonstrates the rehype plugin has run; the outputs in the build folder featuring fetchpriority etc on image attributes.

Actual behavior

Unchanged images in output

Your environment

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed: questionThis issue is a user error/misunderstanding.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions