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

adding mermaid block #44

Merged
merged 1 commit into from
Sep 24, 2024
Merged

adding mermaid block #44

merged 1 commit into from
Sep 24, 2024

Conversation

Copy link

aem-code-sync bot commented Sep 20, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

Copy link

aem-code-sync bot commented Sep 20, 2024

});

export default class Mermaid extends ComponentBase {
ready() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems the preview links are not working anymore. I get 404.
Not sure how many layout shifts Mermaid will create but maybe we can improve this by making ready() async and waiting for mermaid.run() now our component will be made visible only after Mermaid is initialized.

async ready() { 
    const code = this.querySelector('code');
    if(!code) {
      throw new Error('Cannot initialize mermaid without code content.');
    }
    code.textContent = code.textContent.replace(/:\n/g, ': \n');
    await mermaid.run({ nodes: [code] });
  }

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The links work again, change some configs yesterday and forgot to switch the back. I tried this but unfortunately then we seem to have a race condition as sometimes mermaid fails to initialise then with parsing Error: svg element not in render tree. I think for now the performance drop is fine, we can still improve things later.

@nc-andreashaller nc-andreashaller merged commit 3314ce9 into main Sep 24, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants