diff --git a/src/Renderer/PostProcessor/CssInliner.php b/src/Renderer/PostProcessor/CssInliner.php index 0bdf5ba..786b1d5 100644 --- a/src/Renderer/PostProcessor/CssInliner.php +++ b/src/Renderer/PostProcessor/CssInliner.php @@ -8,6 +8,17 @@ final class CssInliner { + /** + * Matches a downlevel-*hidden* Outlook conditional comment (``). + * + * The negative lookahead excludes the downlevel-*revealed* form + * (`…`), whose body is live DOM for every + * non-Word parser and must therefore still be inlined into. + */ + private const CONDITIONAL_COMMENT = '/)[\s\S]*?/'; + + private const STYLE_TAG = '/]*>.*?<\/style>/s'; + /** * Inline CSS styles into HTML elements. * @@ -24,27 +35,47 @@ public static function inline(string $html, array $inlineStyles): string $extraCss = implode('', $inlineStyles); - // Temporarily remove