CSS Blocks
Put scoped stylesheet rules in a {{{#css ... }}} block.
Basic Usage
{{{#css
.profile-card {
border: 1px solid #ddd;
border-radius: 8px;
padding: 12px;
}
}}}Parameters
#css does not accept parameters. Write raw stylesheet content directly after #css.
Use @media (prefers-color-scheme: dark) for the reader device theme. Use body[data-sm-theme="dark"] .label to match an explicit theme on the body. Use #dark-color and other dark parameters to follow an inherited body theme. Host theme classes outside the body do not affect authored selectors.
Sanitization Model
SevenMark emits ordinary HTML inside its declared body root. The sanitizer confines every selector compound to that body and excludes nested body roots. It applies the same rule inside :is(), :where(), :not(), :has() and :nth-child(... of ...). Parent and sibling selectors cannot consult elements outside the body. Supported nested rules retain the same boundary.
html, body, :root and :scope refer to the containing body root. The normal html body and html > body chains refer to that same root. Contradictory root paths are rejected. ID selectors use logical anchor names and map to the actual body IDs. ID attribute selectors consult logical anchor metadata. Nested include islands keep the containing CSS root while their IDs use a separate namespace.
CSS blocks can target ordinary document structure:
tr.tab {
display: none;
}
tr.selected {
display: table-row;
}
a.tab {
cursor: pointer;
}
.i-have-span > span {
font-weight: bold;
}
td > div {
white-space: nowrap;
}
details[open] summary {
font-weight: bold;
}Unsupported shadow selectors are removed, including :host, :host-context(...), ::slotted(...), and ::part(...).
The renderer still sanitizes properties, values, and at-rules. Overlay and dynamic CSS capabilities such as position, inset, z-index, pointer-events, url(), var(), env(), expression(), !important, @import, @font-face, and @keyframes are blocked.
Raw Close Rules
The parser finds the closing delimiter by triple-brace depth:
{{{increases the depth, and}}}decreases it.- The block closes when the depth returns to zero.
- If the CSS ends with
}, the formatter can insert a separator before the closing}}}to keep the boundary clear.
Fenced code and dollar-delimited math use their own delimiters. They do not use this CSS close rule.
Example:
{{{#css
.profile-card { border: 1px solid #ddd; }
}}}Notes
- The parser reads CSS as raw text. It does not evaluate nested SevenMark syntax.
- Backslash-escaped triple-brace delimiters stay in the raw CSS text.
- Each CSS block allows up to 1 MiB input and output, a lexical nesting depth of 32 and a rule depth of 128. Selector expansion uses the existing output limit. An exhausted rewrite emits no unscoped fallback.
- Unsupported selectors and CSS admission failures produce coarse source warnings. Safe rules in the same block remain when the whole block stays within its budget. Included CSS warnings identify the host include call. The editor shares the renderer's selector policy but does not predict host-specific expansion cost.
- Renderer sanitizes style-close tags such as
</style>to prevent tag break-out.