Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

web: Client-side MDX rendering #13610

Merged
merged 5 commits into from
Mar 21, 2025
Merged

web: Client-side MDX rendering #13610

merged 5 commits into from
Mar 21, 2025

Conversation

GirlBossRush
Copy link
Contributor

@GirlBossRush GirlBossRush commented Mar 21, 2025

Details

This PR migrates much of the inline documentation MDX rendering to the browser, allowing for a faster build time, the removal of a Chromium as a dependency (via Mermaid), and support for hydrated components (such as Docusaurus style tabs).

Also included is the splitting of inline documentation from ESBuild's core bundle, which should offset the inclusion of MDX's render pipeline.


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

@GirlBossRush GirlBossRush added bug Something isn't working enhancement New feature or request labels Mar 21, 2025
@GirlBossRush GirlBossRush self-assigned this Mar 21, 2025
@GirlBossRush GirlBossRush requested review from a team as code owners March 21, 2025 03:31
Copy link

netlify bot commented Mar 21, 2025

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 57c3c99
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/67ddb4d85931670008703241
😎 Deploy Preview https://deploy-preview-13610--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Mar 21, 2025

Deploy Preview for authentik-docs canceled.

Name Link
🔨 Latest commit 57c3c99
🔍 Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/67ddb4d8225ded00086bbe99

@GirlBossRush GirlBossRush force-pushed the esbuild-propagate-errors branch from 8ecc05a to 442c344 Compare March 21, 2025 03:32
Comment on lines -180 to +201
await Promise.allSettled(
return Promise.all(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes issue where build errors are swallowed during compile.

Comment on lines +140 to +142
prefix: "mermaid-svg-",
colorScheme: this.activeTheme === UiThemeEnum.Dark ? "dark" : "light",
} satisfies RehypeMermaidOptions,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mermaid's support for dynamic theming is a mess and doesn't handle non-hex code colors all that well. This needs revising when branding becomes more precise.

Comment on lines +147 to +150
const { default: Content, ...mdxExports } = await runMDX(mdx, {
...runtime,
baseUrl: import.meta.url,
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like our previous rendering with Showdown, this assumes trusted authorship of content. Blueprints may require another remark plugin to sanitize the HTML.

Copy link

codecov bot commented Mar 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.76%. Comparing base (ab7338b) to head (57c3c99).
Report is 8 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13610      +/-   ##
==========================================
+ Coverage   92.74%   92.76%   +0.01%     
==========================================
  Files         794      794              
  Lines       40502    40502              
==========================================
+ Hits        37565    37570       +5     
+ Misses       2937     2932       -5     
Flag Coverage Δ
e2e 48.02% <ø> (+0.05%) ⬆️
integration 24.30% <ø> (ø)
unit 90.52% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

github-actions bot commented Mar 21, 2025

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-57c3c995259b881b0f6872e3b1e45f03aba555ae
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-57c3c995259b881b0f6872e3b1e45f03aba555ae

Afterwards, run the upgrade commands from the latest release notes.

Signed-off-by: Teffen Ellis <[email protected]>
@BeryJu BeryJu changed the title Client-side MDX rendering web: Client-side MDX rendering Mar 21, 2025
Signed-off-by: Jens Langhammer <[email protected]>
@BeryJu BeryJu merged commit 0b806b7 into main Mar 21, 2025
93 checks passed
@BeryJu BeryJu deleted the esbuild-propagate-errors branch March 21, 2025 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants