Description
The Insert CSS File action reads the CSS file contents and injects them as an
inline <style> block directly inside <div id="wrapper"> in the document
body — not into <head>. The <style> element belongs in <head>, not
inside a <div> in <body>. While some browsers are lenient about this, it
is invalid HTML and not guaranteed to work correctly.
Steps to Reproduce
- In Custom Rules, add an Insert CSS File action pointing to any CSS file
- Export the document as HTML
- Inspect the HTML source around
<div id="wrapper">
Expected Behavior
<head>
<style type="text/css">
/* Vostock style */
</style>
<style type="text/css">
/* contents of injected CSS file */
</style>
</head>
Actual Behavior
Verified from exported HTML (Parshat Bamidbar — Dvar Torah.TEMP_4.html):
</style> ← Vostock style closes here
</head> ← head closes here
<body class="export">
<div id="wrapper"><style>/*
* Hebrew Kriah Style for Marked 3
* ================================
...
*/
</style>
The full CSS file contents are injected as a <style> block at the very
start of <div id="wrapper"> — after </head> has already closed.
Documentation Reference
The Marked 3 Custom Processor docs describe Insert CSS File as injecting CSS
"after any Style selection." The Marked 3 Exporting docs state styles are
embedded in the output. Both imply CSS injection occurs in <head> alongside
the selected style — not in <body>:
"You can optionally include any of Marked's styles (or one of your custom
styles) in your export, giving you a ready-to-go document with necessary
formatting already embedded."
— https://markedapp.com/help/Exporting.html