-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
Using Safari makes the svg rendering looks blurry #499
Comments
Duplicated: #225 |
Your thoughts are generally right. Marp Core is depending on scaling without client JS powered by SVG rendering issues in Safari would resolve future by working for Layer-based SVG engine, so we are holding on to fix it for now. |
Layer-based SVG engine (LBSE) is still in development and very unstable. (Probably it's a reason why it is hidden deep in debug menu) If its implementation made stable, LBSE should display contents of the slide clearly even if scaled. You can try to disable engine.jsconst { Marp } = require('@marp-team/marp-core');
module.exports = (opts) => new Marp({
...opts,
inlineSVG: false,
}); npm i @marp-team/marp-core
marp --engine ./engine.js slide.md
Safari does not apply scaling correctly supplied by SVG The LBSE contributor has mentioned it offers a fully compatible See also: WebKit/WebKit@7fd975a |
As you mentioned, the engine is still unstable at the moment, so I'll avoid hosting the inlineSVG html version online for the moment. |
Inline SVG mode is still experimental in Marpit framework, the base framework of Marp Core. But Marp Core relies on inline SVG mode, for getting both of simpler architecture and less JS scripting, even at the price of the browser compatibility. There are different meaning of scaling in inline SVG and For slide reproducibility among various use cases, Marp have taken an approach to make slide size immutable rregardless of the context in around. So our tools have no official support for non inline SVG mode.
|
FYI Safari TP's LBSE renders better and clear slide as same as other browsers, by preventing slide transforming by marpit-svg-polyfill. <style>
/* For Safari TP's LBSE mode */
section {
transform: none !important;
}
</style> I'm working on LBSE detection in marpit-svg-polyfill: marp-team/marpit-svg-polyfill#50 |
The latest Marp Core and Marp CLI v2.4.0 has included an updated polyfill (marpit-svg-polyfill v2.1.0). If enabled Layer-based SVG engine, you should see not blury contents. (Another layout issue still may show caused by in development LBSE) |
Version of Marp Tool
@marp-team/marp-cli v2.3.0 (w/ @marp-team/marp-core v3.4.2)
Operating System
macOS
Environment
How to reproduce
marp foo.md
to output the htmlExpected behavior
That all contents are rendered normally on screen.
Actual behavior
Each page wrapped in the svg gets pixelated when viewed in Safari.
Additional information
Some forks suggested that this has been a known issue in Safari for a long time. If you scales up a svg element, it seems Safari is actually scaling up the bitmap version that it cached. I think that it might be due to marp-core scaling up the svg in marp-auto-scaling.ts, and I wonder if there's any workaround, because marp-cli doesn't allow overriding the inlineSVG setting. I read that one workaround would be to set a higher width and scales down afterwards - rather than to scale up. Not sure if that will help.
Below are the rendering results in Chrome vs Safari, in case the blur is inapparent (in the 2nd image), open it in a new tab.
The text was updated successfully, but these errors were encountered: