mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
70.78k stars 6.35k forks source link

Server Side Support #3650

Open Yash-Singh1 opened 1 year ago

Yash-Singh1 commented 1 year ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Support for server-side rendering of Mermaid.js such as Node.js

Describe the solution you'd like A clear and concise description of what you want to happen.

This has been discussed in #559 and #1183. I looked into the source code and noticed that a browser environment is required to precompute widths/heights. Just saw this project, maybe we can use Vercel's Satori. It internally uses Facebook's Yoga, a cross-compatible flexbox implementation.

aloisklink commented 1 year ago

This would also greatly help the mermaid-cli project! It currently uses puppeteer to create a browser instance to render Mermaid diagrams, but that's a very very heavy program (and has caused mermaid-cli to be removed from homebrew: https://github.com/mermaid-js/mermaid-cli/issues/288#issuecomment-1270824782)

Alternative Solutions

svgdom might help as well, as it adds a bunch of SVG DOM features to Node.JS.

Issues

We'd most likely have to change the default font to an open-source font too, since the default fonts are owned by Microsoft:

https://github.com/mermaid-js/mermaid/blob/c99fd2baa9eaf156ea3218d691289f3d95ba9341/packages/mermaid/src/defaultConfig.ts#L50

I'd recommend https://fonts.google.com/specimen/Atkinson+Hyperlegible as a good default, since it's designed for people with low vision, and it's available under the Open Font License. The license is very permissive, we just need to:

At a minimum you must include the copyright statement, the license notice and the license text. A mention of this information in your About box or Changelog, with a link to where the font package is from, is good practice [...]

From https://scripts.sil.org/cms/scripts/page.php?item_id=OFL-FAQ_web#2a57c6bb (Question 1.20)

sidharthv96 commented 1 year ago

This could also enable the generation of diagram previews when linking to live editor.

knsv commented 1 year ago

Lots of possibilities with this one.

slorber commented 1 year ago

We just finished the integration of Mermaid in Docusauurs (https://github.com/facebook/docusaurus/pull/7490)

We would also really like to have SSR support:

Important thing to consider: it would be great if the SVG output did use CSS variables so that we can do theming and support dark/light mode:

aloisklink commented 1 year ago

We just finished the integration of Mermaid in Docusauurs (https://github.com/facebook/docusaurus/pull/7490)

Exciting stuff! I'm looking forwards to the next Docusaurus release then! :rocket:

I do have a server-side rendering (SSR) plugin for remark called remark-mermaid-dataurl that works for docusaurus, but the way it works is by using puppeteer to render the SVGs, so it's very slow and heavy (puppeteer downloads a copy of the chromium browser on the server and it's a 450+ MiB download!)

Important thing to consider: it would be great if the SVG output did use CSS variables so that we can do theming and support dark/light mode:

It might be easier to hard-code them for a few reasons:

Docusaurus would always be able to override the Mermaid default CSS with their own custom CSS using the themeCSS option.

Although, adding server-side rendering support to Mermaid will probably take a while, so maybe some of these considerations will change over time.

ggrossetie commented 1 year ago

Would you be open to integrate a mechanism to convert text to SVG paths (such as https://maker.js.org/ or https://github.com/vercel/satori)?

It would solve font cut-off issues when a diagram is generated server-side because the font is very likely not going to be rendered identically on the client side.

DanInProgress commented 1 year ago

This is something I've been interested in for a while, I currently use mermaid with gatsby for my blog. (including maintaining a fork of a plugin to prerender diagrams with puppeteer. I may start experimenting with this over the holiday break--puppeteer is easily the most fragile part of my static site build.

I saw others successfully leverage jsdom to render d3 charts, so I think I'll probably start there

@aloisklink do you know of any obvious stumbling blocks for that approach? edit: just saw your comment on #3491 (link) , so yeah, may have some problems...

@Mogztter that's an interesting idea, did you have any thoughts on how to address the SEO and accessibility concerns of such an approach? Charts tend to be much more vital to understanding the content of a page than other types of figures, and removing all text might cause problems with this.

ggrossetie commented 1 year ago

that's an interesting idea, did you have any thoughts on how to address the SEO and accessibility concerns of such an approach? Charts tend to be much more vital to understanding the content of a page than other types of figures, and removing all text might cause problems with this.

I think we should use the title element with an aria-labelledby: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title

The element provides an accessible, short-text description of any SVG <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element#container_elements">container element</a> or <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element#graphics_elements">graphics element</a>.</p> <p>If an element can be described by visible text, it is recommended to reference that text with an <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby">aria-labelledby</a> attribute rather than using the <title> element.</p> </blockquote> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/DanInProgress"><img src="https://avatars.githubusercontent.com/u/101540019?v=4" />DanInProgress</a> commented <strong> 1 year ago</strong> </div> <div class="markdown-body"> <p>Also just to make sure I understand the issue you're describing:</p> <blockquote> <p>when a diagram is generated server-side because the font is very likely not going to be rendered identically on the client side.</p> </blockquote> <ol> <li>A diagram is rendered as an svg on one computer, (say a server)</li> <li>The server decides on the spacing/size of elements using the calculated width of the text contained</li> <li>The svg is saved and transferred to a second computer where mermaid is not present</li> <li>The svg is opened and without mermaid/d3 to recalculate, the elements overlap or text is cut off</li> </ol> <p>does that sum it up correctly?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/ggrossetie"><img src="https://avatars.githubusercontent.com/u/333276?v=4" />ggrossetie</a> commented <strong> 1 year ago</strong> </div> <div class="markdown-body"> <p>That's correct!</p> <blockquote> <p>The server decides on the spacing/size of elements using the calculated width of the text contained</p> </blockquote> <p>Actually, Mermaid calculates the spacing/size of boxes based on the rendered size of the text (contained in it) using a given font and rendering engine (browser).</p> <p>When you open the generated SVG generated on another machine/browser the font will be rendered differently, small differences on the letter spacing but in then end the text can exceed the box width. </p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/aloisklink"><img src="https://avatars.githubusercontent.com/u/19716675?v=4" />aloisklink</a> commented <strong> 1 year ago</strong> </div> <div class="markdown-body"> <blockquote> <p>Would you be open to integrate a mechanism to convert text to SVG paths (such as <a href="https://maker.js.org/">https://maker.js.org/</a> or <a href="https://github.com/vercel/satori">https://github.com/vercel/satori</a>)?</p> <p>It would solve font cut-off issues when a diagram is generated server-side because the font is very likely not going to be rendered identically on the client side.</p> </blockquote> <p>It would be better to bundle the fonts somehow (e.g. if using <code>Satori</code>, there's the font embedding option, see <a href="https://github.com/vercel/satori#font-embedding">https://github.com/vercel/satori#font-embedding</a>).</p> <p>The only issue is then we'd be limited to fonts with an open-source license (but that's probably a good thing! The default Mermaid font of Tahoma is owned by Microsoft, so can be hard to install on Linux. Maybe <a href="https://fonts.google.com/specimen/Atkinson+Hyperlegible">https://fonts.google.com/specimen/Atkinson+Hyperlegible</a> is a good option).</p> <blockquote> <p>I think we should use the <code><title></code> element with an <code>aria-labelledby</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title">https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title</a></p> </blockquote> <p>We already have a <code><title></code> element, and @weedySeaDragon has just opened a PR to add a <code>aria-labelledby</code> to point to it <a href="https://github.com/mermaid-js/mermaid/pull/3808">https://github.com/mermaid-js/mermaid/pull/3808</a>! More importantly, that PR also improves the docs, so hopefully people use the accessibility features more.</p> <blockquote> <p>Actually, Mermaid calculates the spacing/size of boxes based on the rendered size of the text (contained in it) using a given font and rendering engine (browser).</p> </blockquote> <p>As far as I'm aware, that's correct. And since <code>jsdom</code> doesn't support calculating layouts, it can't fully help us. <a href="https://github.com/svgdotjs/svgdom">svgdom</a> might help though, but who knows :shrug:</p> <p>PRs are always welcome if anybody wants to try it out, though!</p> <blockquote> <p>When you open the generated SVG generated on another machine/browser the font will be rendered differently, small differences on the letter spacing but in then end the text can exceed the box width.</p> </blockquote> <p>If both the server and client have the exact same font and same CSS settings, it <em>might</em> be that the generated SVGs are similar enough that letter spacing won't change. From my limited experience with <a href="https://github.com/mermaid-js/mermaid-cli">mermaid-cli</a> and <a href="https://github.com/aloisklink/remark-mermaid-dataurl">remark-mermaid-dataurl</a> (which use puppeteer), pre-generated SVGs look mostly identical to client-generated SVGs, as long as both computers had the same fonts installed. But I am mainly testing Ubuntu x86_64 machines using Chromium, so there's not a lot of variety there.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/ghost"><img src="https://avatars.githubusercontent.com/u/10137?v=4" />ghost</a> commented <strong> 1 year ago</strong> </div> <div class="markdown-body"> <p>Possibly relates to:</p> <ul> <li><a href="https://github.com/mermaid-js/mermaid-cli/issues/103">https://github.com/mermaid-js/mermaid-cli/issues/103</a></li> <li><a href="https://github.com/mermaid-js/mermaid/issues/1845">https://github.com/mermaid-js/mermaid/issues/1845</a></li> <li><a href="https://github.com/mermaid-js/mermaid/issues/2102">https://github.com/mermaid-js/mermaid/issues/2102</a></li> <li><a href="https://github.com/mermaid-js/mermaid/issues/2485">https://github.com/mermaid-js/mermaid/issues/2485</a></li> <li><a href="https://github.com/mermaid-js/mermaid/issues/2564">https://github.com/mermaid-js/mermaid/issues/2564</a></li> </ul> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/taylorh140"><img src="https://avatars.githubusercontent.com/u/10996543?v=4" />taylorh140</a> commented <strong> 1 year ago</strong> </div> <div class="markdown-body"> <p>I was thinking of different ways to do this, and I wanted to talk about solution combos.</p> <p>One mentioned here was:</p> <ul> <li>Nodejs + svgdom + mermaid. (as of yet untested?) If this does end up working then it's possible to take this stack elsewhere. </li> <li>(source language) + embedded Javascript engine + svgdom + mermaid.</li> </ul> <p>I would like to compile mermaid to a wasm so it can be portable and more secure/sandboxed, and used more easily in different places.</p> <p>One of the key items that Mermaid is missing is the layout engine, but the expense of the browser is quite a lot. I saw there are browser engines, and I was contemplating something like this:</p> <p>rust + servo + mermaid -> wasm (servo is a rust browser engine.) might be a possible solution.</p> <p>This looks like a problem that would really be nice to have a lighter solution for, but also pretty involved. So it would be nice to fined a path that looks like it will have a good performance/size result in the end and be flexible for embedding. </p> <p>If anyone has more or better ideas I would like to hear them.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/ghost"><img src="https://avatars.githubusercontent.com/u/10137?v=4" />ghost</a> commented <strong> 1 year ago</strong> </div> <div class="markdown-body"> <p>@taylorh140, my recommendation would be to solve the deeper problem. The reason why MermaidJS cannot be easily run server-side (outside of a browser environment) is because it doesn't generate SVG-compliant output. While leveraging browser features (i.e., HTML/CSS) may make development faster/simpler to generate complex SVG diagrams, it comes with the disadvantage that nearly every third-party SVG library available cannot handle embedded HTML. (After all, why should an SVG library be burdened with also implementing a non-trivial chunk of the HTML/CSS specification?)</p> <p>@jgreywolf is looking into this problem. See issue #2485 for details.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/aloisklink"><img src="https://avatars.githubusercontent.com/u/19716675?v=4" />aloisklink</a> commented <strong> 1 year ago</strong> </div> <div class="markdown-body"> <blockquote> <p>The reason why MermaidJS cannot be easily run server-side (outside of a browser environment) is because it doesn't generate SVG-compliant output.</p> </blockquote> <p>FYI, I think these are two separate issues. Converting MermaidJS to create SVG 1.1 compliant SVGs would be easier, we just need to avoid using HTML in diagrams (I believe many diagrams already have a <a href="https://mermaid.js.org/config/schema-docs/config.html#htmllabels"><code>htmlLabel: false</code> option</a> to avoid using embedded HTML) and avoid using new CSS/SVG features that aren't supported in SVG 1.1.</p> <p>I believe <code>svgdom</code> only supports SVG 1.1, so fixing #2485 might be a necessary step for getting server-side rendering working!</p> <hr /> <blockquote> <p>rust + servo + mermaid -> wasm (servo is a rust browser engine.) might be a possible solution.</p> </blockquote> <p>This might be a struggle, see <a href="https://github.com/servo/servo/discussions/28070">https://github.com/servo/servo/discussions/28070</a></p> <p><a href="https://github.com/facebook/yoga">yoga</a> is a C++ layout engine that has a WASM version on npm, see <a href="https://www.npmjs.com/package/yoga-layout">https://www.npmjs.com/package/yoga-layout</a>, but unfortunately it doesn't yet support text layout. (although we might be able to hack it it together, with a fixed font like <a href="https://github.com/DioxusLabs/taffy/blob/daf416438b5379bf4d8b3dd79ab20c8bc78754aa/tests/generated/mod.rs#L8-L62">https://github.com/DioxusLabs/taffy/blob/daf416438b5379bf4d8b3dd79ab20c8bc78754aa/tests/generated/mod.rs#L8-L62</a>, since Yoga does support adding your own text <code>measure()</code> function: <a href="https://github.com/facebook/yoga/issues/54">https://github.com/facebook/yoga/issues/54</a>).</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/ghost"><img src="https://avatars.githubusercontent.com/u/10137?v=4" />ghost</a> commented <strong> 1 year ago</strong> </div> <div class="markdown-body"> <p>From @aloisklink 's comments:</p> <blockquote> <p>I believe many diagrams already have a <code>htmlLabel: false</code> option ...</p> <p>Some diagrams have a <code>htmlLabels: false</code> option that you can use to remove <code><foreignObject></code> and use only SVG tags</p> </blockquote> <p>My understanding is that <code>flowChart</code> graph types support that option, and there's work to move the option up:</p> <ul> <li><a href="https://github.com/mermaid-js/mermaid/issues/58#issuecomment-73567103">https://github.com/mermaid-js/mermaid/issues/58#issuecomment-73567103</a></li> <li><a href="https://github.com/mermaid-js/mermaid/issues/58">https://github.com/mermaid-js/mermaid/issues/58</a></li> <li><a href="https://github.com/mermaid-js/mermaid/issues/2688#issuecomment-1242762992">https://github.com/mermaid-js/mermaid/issues/2688#issuecomment-1242762992</a></li> </ul> <p>See also:</p> <ul> <li> <h1>3337 -- suggests moving option out of <code>flowChart</code></h1> </li> <li> <h1>1431 -- task to do the work of moving option out of <code>flowChart</code></h1> </li> </ul> <p>When #1431 is finished, maybe it'll work?</p> <p>I don't know how many graphs support that option.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/ghost"><img src="https://avatars.githubusercontent.com/u/10137?v=4" />ghost</a> commented <strong> 11 months ago</strong> </div> <div class="markdown-body"> <p>FYI, in two days I will be locked out of my account once GitHub begins enforcing MFA. Sorry I won't be able to help any further.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/tex0l"><img src="https://avatars.githubusercontent.com/u/7548264?v=4" />tex0l</a> commented <strong> 11 months ago</strong> </div> <div class="markdown-body"> <p>By the way, I decided to use <a href="https://github.com/hikerpig/pintora">Pintora</a> instead which has fewer features, but which renders entirely on the server side.</p> <p>It works fine in an Astro component:</p> <pre><code class="language-ts">--- import {createHash} from 'node:crypto' import {PintoraConfig} from '@pintora/standalone'; import {render} from '@pintora/cli' interface Cache { [key: string]: string; } export interface Props { config?: PintoraConfig; code: string; } const cache: Cache = {} const generateHash = (input: string) => { const hash = createHash('sha256') hash.update(input) return hash.digest().toString('hex') } const {config, code} = Astro.props const uniqueKey = generateHash(JSON.stringify(Astro.props)); if (cache[uniqueKey] === undefined) { /* Render the mermaid diagram */ try { const result = await render({ code: code, pintoraConfig: config, mimeType: 'image/svg+xml' }); if (typeof result === 'string' && result !== '') { cache[uniqueKey] = result; } else if (result instanceof Buffer) throw new Error('Unexpected buffer') } catch (error) { console.error(error) } } --- { cache[uniqueKey] && ( <div class="pintora"> <Fragment set:html={cache[uniqueKey]}/> </div> ) } <style> .pintora { /* Necessary to avoid pixelated font rendering on macOS/Chrome, why? */ /* Also, why this looks awful on Safari with every settings tested? */ -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; /* Necessary for Safari, which doesn't make the SVG full width, why? */ display: flex; justify-content: center; width: 100%; } </style> </code></pre> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/ghost"><img src="https://avatars.githubusercontent.com/u/10137?v=4" />ghost</a> commented <strong> 9 months ago</strong> </div> <div class="markdown-body"> <p>This really needs fixed</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/titanism"><img src="https://avatars.githubusercontent.com/u/101466223?v=4" />titanism</a> commented <strong> 9 months ago</strong> </div> <div class="markdown-body"> <blockquote> <p>By the way, I decided to use <a href="https://github.com/hikerpig/pintora">Pintora</a> instead which has fewer features, but which renders entirely on the server side.</p> <p>It works fine in an Astro component:</p> <pre><code class="language-ts">--- import {createHash} from 'node:crypto' import {PintoraConfig} from '@pintora/standalone'; import {render} from '@pintora/cli' interface Cache { [key: string]: string; } export interface Props { config?: PintoraConfig; code: string; } const cache: Cache = {} const generateHash = (input: string) => { const hash = createHash('sha256') hash.update(input) return hash.digest().toString('hex') } const {config, code} = Astro.props const uniqueKey = generateHash(JSON.stringify(Astro.props)); if (cache[uniqueKey] === undefined) { /* Render the mermaid diagram */ try { const result = await render({ code: code, pintoraConfig: config, mimeType: 'image/svg+xml' }); if (typeof result === 'string' && result !== '') { cache[uniqueKey] = result; } else if (result instanceof Buffer) throw new Error('Unexpected buffer') } catch (error) { console.error(error) } } --- { cache[uniqueKey] && ( <div class="pintora"> <Fragment set:html={cache[uniqueKey]}/> </div> ) } <style> .pintora { /* Necessary to avoid pixelated font rendering on macOS/Chrome, why? */ /* Also, why this looks awful on Safari with every settings tested? */ -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; /* Necessary for Safari, which doesn't make the SVG full width, why? */ display: flex; justify-content: center; width: 100%; } </style></code></pre> </blockquote> <p>Thank you for sharing Pintora; we're going to try it out! πŸŽ‰ We use Mermaid right now at Forward Email (@forwardemail) and we have had an absolute headache with it due to this issue. Definitely looking to switch.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/tex0l"><img src="https://avatars.githubusercontent.com/u/7548264?v=4" />tex0l</a> commented <strong> 9 months ago</strong> </div> <div class="markdown-body"> <p>Glad I could help!</p> <p>If you use Astro, I published a component: <a href="https://github.com/tex0l/astro-pintora">https://github.com/tex0l/astro-pintora</a></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/titanism"><img src="https://avatars.githubusercontent.com/u/101466223?v=4" />titanism</a> commented <strong> 8 months ago</strong> </div> <div class="markdown-body"> <p>πŸ‘‹ Hi there folks!</p> <p>πŸ’¬ What's this comment about?</p> <p>Here at <a href="https://forwardemail.net">Forward Email</a> (@forwardemail) - we tried out Mermaid (v6-latest), then we tried Pintora Standalone, then we tried Pintora CLI, then we tried Mermaid again, and then finally Mermaid CLI.</p> <p><strong>Unfortunately both Mermaid and Pintora have Content-Security-Policy ("CSP") issues if used client-side</strong> - and they also have issues with <a href="https://github.com/mermaid-js/mermaid-cli/issues/632">server-side rendering</a> (<a href="https://github.com/hikerpig/pintora/issues?q=is%3Aissue+author%3Atitanism+">or rendering in general</a>).</p> <p>Ultimately we ended up using Mermaid CLI to render the assets with retina and dark/light mode theme support. Albeit it's not pretty, it has built-in caching and works remarkably well. We wanted to share it here with the community :tada:...</p> <p>πŸ”΄ <strong>Live Demo:</strong> <a href="https://forwardemail.net/blog/docs/best-quantum-safe-encrypted-email-service#how-does-it-work">https://forwardemail.net/blog/docs/best-quantum-safe-encrypted-email-service#how-does-it-work</a></p> <p>🚧 How does it work?</p> <ol> <li>We write Markdown as usual with Mermaid @ <a href="https://github.com/forwardemail/forwardemail.net/blob/a481cf81bb3195a65683740153e5f4ab08316999/app/views/docs/best-quantum-safe-encrypted-email-service/index.md?plain=1#L81-L89">https://github.com/forwardemail/forwardemail.net/blob/a481cf81bb3195a65683740153e5f4ab08316999/app/views/docs/best-quantum-safe-encrypted-email-service/index.md?plain=1#L81-L89</a></li> <li>Our pug has a built-in filter for Markdown to parse and rewrite blocks using <code>markdown-it</code> @ <a href="https://github.com/forwardemail/forwardemail.net/blob/a481cf81bb3195a65683740153e5f4ab08316999/helpers/markdown.js#L29-L64">https://github.com/forwardemail/forwardemail.net/blob/a481cf81bb3195a65683740153e5f4ab08316999/helpers/markdown.js#L29-L64</a></li> <li>The Mermaid code is converted to an <code>img</code> tag inside a <code>picture</code> (for dark/light mode support), and all of this is inside a <code>a</code> tag that uses a lightbox gallery effect so when the user clicks the chart it expands to a lightbox @ <a href="https://github.com/forwardemail/forwardemail.net/blob/a481cf81bb3195a65683740153e5f4ab08316999/helpers/markdown.js#L45-L55">https://github.com/forwardemail/forwardemail.net/blob/a481cf81bb3195a65683740153e5f4ab08316999/helpers/markdown.js#L45-L55</a></li> <li>The img tag source refers to a route on our side that is server-side rendered @ <a href="https://github.com/forwardemail/forwardemail.net/blob/a481cf81bb3195a65683740153e5f4ab08316999/routes/web/index.js#L59-L130">https://github.com/forwardemail/forwardemail.net/blob/a481cf81bb3195a65683740153e5f4ab08316999/routes/web/index.js#L59-L130</a></li> <li>We have built-in caching with <code>global</code> (process) and using Redis (via <code>ioredis</code>) @ <a href="https://github.com/forwardemail/forwardemail.net/blob/a481cf81bb3195a65683740153e5f4ab08316999/routes/web/index.js#L69-L93">https://github.com/forwardemail/forwardemail.net/blob/a481cf81bb3195a65683740153e5f4ab08316999/routes/web/index.js#L69-L93</a></li> </ol> <p>❓ Why bother?</p> <p>We were aiming to pass 100% on all tests (and we did; as far as we know we're the only email service to do this):</p> <ul> <li>βœ… Hardenize: <a href="https://www.hardenize.com/report/forwardemail.net?refreshReport=true">https://www.hardenize.com/report/forwardemail.net?refreshReport=true</a></li> <li>βœ… Mozilla Observatory: <a href="https://observatory.mozilla.org/analyze/forwardemail.net">https://observatory.mozilla.org/analyze/forwardemail.net</a></li> <li>βœ… Internet.nl Site: <a href="https://internet.nl/site/forwardemail.net">https://internet.nl/site/forwardemail.net</a></li> <li>βœ… Internet.nl Mail: <a href="https://internet.nl/mail/forwardemail.net">https://internet.nl/mail/forwardemail.net</a></li> <li>βœ… Google PageSpeed Insights: <a href="https://pagespeed.web.dev/analysis?url=https%3A%2F%2Fforwardemail.net%2Fen">https://pagespeed.web.dev/analysis?url=https%3A%2F%2Fforwardemail.net%2Fen</a></li> </ul> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/XIYO"><img src="https://avatars.githubusercontent.com/u/27078637?v=4" />XIYO</a> commented <strong> 1 month ago</strong> </div> <div class="markdown-body"> <p>Hello,</p> <p>I am not a native English speaker, so I have used a translation tool to read the issue and write this message.</p> <p>I am using playwright to simulate a browser environment for server-side rendering. However, when I moved the deployment environment from GitHub Pages to Cloudflare, I encountered an issue where Cloudflare’s build tools could not install the necessary browser environment. As a result, I have to continue using GitHub Actions for the build process.</p> <p>Although the problem can be resolved by building in GitHub Actions and then deploying to Cloudflare, I am looking for a better solution.</p> <p>From what I have read in the issue discussion, it seems there is no direct solution yet, and the workaround involves adding additional dependencies. I am curious to know if this problem is on the roadmap or if the MermaidJS team is aware of and actively monitoring this issue?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/aloisklink"><img src="https://avatars.githubusercontent.com/u/19716675?v=4" />aloisklink</a> commented <strong> 1 month ago</strong> </div> <div class="markdown-body"> <blockquote> <p>I am curious to know if this problem is on the roadmap or if the MermaidJS team is aware of and actively monitoring this issue?</p> </blockquote> <p>Hi, I'm technically a member of the @mermaid-js team (although I focus more on the <a href="https://github.com/mermaid-js/mermaid-cli">https://github.com/mermaid-js/mermaid-cli</a> project), and this is a big wishlist item for me!</p> <p>But it most likely won't happen anytime soon. We'd need some sort of tool with a layout engine.</p> <p>One of the jsdom engineers estimated it would take a very talented engineer 3-6 months working full-time to add it to jsdom: <a href="https://github.com/jsdom/jsdom/issues/1322#issuecomment-380891769">https://github.com/jsdom/jsdom/issues/1322#issuecomment-380891769</a>.</p> <p>I'm still hoping that <a href="https://servo.org/">https://servo.org/</a> might do the job, once it's done! If you look at <a href="https://wpt.servo.org/">https://wpt.servo.org/</a>, they're slowly implementing more and more CSS features!</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>Β© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>