Bethesda markup handling
A book’s content is Bethesda’s HTML-like markup (see
book markup assets):
<font face='$HandwrittenFont'><font size='40'><p align='center'>
Conjure Dremora Lord
<img src='img://Textures/Interface/Books/Alchemy Ingredients/dragonfly.png'>
BookContentSanitizer.RenderParagraphsHtml interprets a small set of tags and shows every other
tag as text. It is a single forward scan, no regex (see Performance); tag
matching, attributes and the <img>/<font> rendering live in Rendering/Markup/. Every other
value on a page (title, EditorIDs, cell names) is only HTML-encoded (EscapePlainText): its markup,
such as <Alias=Home>, shows as text.
Interpreted tags
| Markup | Output | Notes |
|---|---|---|
<p align>, <div align> | <p style="text-align: ..."> | One paragraph: blank lines inside become <br />. align is checked against left, right, center, justify, else left. Vanilla journals use <div align> the same way and never close it |
[pagebreak], <pagebreak> | <hr class="pagebreak"> | Both spellings exist in vanilla data |
<HR> | <hr> | A different construct, seen around an embedded poem |
<b>, <i>, <u> | the same tag | Inline: never starts a paragraph |
<br>, <BR>, <br/> | <br /> | |
<img src> | <img> from the site’s textures/ | Only when the reference resolves (TextureAssets, same normalization as the exporter’s TextureSource, duplicated on purpose). width and height carry over, see Book page geometry. The alt is empty, except for a vanilla illuminated letter (X_letter.png or the Lost Library mod’s X_letter_LL.png, in a folder named Illuminated_Letters): its capital letter, which the book page’s meta description also reads |
<font face size alpha> | <span style> | face through the language’s fonts (FontAssets) into font-family; size as px in the book’s stage pixels; alpha (#XX) as opacity. Any one attribute is enough |
Anything else stays in the text, HTML-encoded, where it was: an unresolved <img> or <font face>,
the game’s runtime placeholders (<Alias=...>, <Global=...>), unfilled dev placeholders
(<Cool graphic>), localizers’ “untranslatable” markers, typos (<align='left'>, <imgsrc=...>).
The reader sees the real markup instead of a guess or a gap.
Rules
- Paragraphs. Text outside
<p>splits into paragraphs on a blank line; a single line break becomes<br />. The blank line is found during the scan, not by splitting afterwards, so a tag open across it is never cut into an unclosed half and an orphan close. - Unclosed tags. An unclosed or reopened
<p align>is closed.<b>,<i>and<u>are also closed at every paragraph boundary (</p>, page break, blank line): vanilla books leave an<i>open, or reopen it by typo, and it must not leak. A stray closing tag shows as text. <font>crosses boundaries. A still-open font span is closed and reopened across a new<p>, a page break or a blank line. Vanilla titles put<font size='40'>right before a new<p align>, and letters never close their<font face>: the tag is meant for what follows (InlineStyleStack).- Missing
=. Every vanilla spell tome writesface'$HandwrittenFont'(a Creation Kit bug, e.g.skyrim.esm:10F7F4).AttributeScannerreads a quote right after an attribute name as if the=were there. - Face names. A face resolves only on an exact fontconfig name.
$CClub_Fontdoesn’t match its embedded font’s name (see Font export), so it shows as text.
Default face
Book text without a <font face> uses $SkyrimBooks in-game. BookPageWriter sets it on the
content block (FontAssets.DefaultContentFamily), falling back to a font named
SkyrimBooks_Gaelic when the fontconfig name doesn’t resolve, and to the stylesheet’s serif when the
language has neither. An explicit <font face> inside overrides it.
Images and fonts on disk
generate:site copies the export’s textures/ once and each language’s fonts/ into its subsite;
TextureAssets and FontAssets resolve against what was really copied. A book page carries its
language’s @font-face rules inline. A book’s inventoryImage resolves the same way and shows as a
thumbnail next to its field.