scribble
scribble copied to clipboard
HTML style attributes aren't applied to `*section`s
The following Scribble file,
#lang scribble/manual
@(require
scribble/html-properties
scribble/core)
@(define red-style
(make-style #f (list (attributes '((style . "color: red"))))))
@elem[#:style red-style]{red elem}
@section[#:style red-style]{red section}
@subsection[#:style red-style]{red subsection}
@subsection[#:style red-style]{red subsubsection}
is supposed to display all the text in the elem and *sections in red.
However, the style isn't applied to the *sections. The HTML is
...
<p><span style="color: red">red elem</span></p>
<h3>1<tt> </tt><a name="(part._red_section)"></a>red section</h3>
<h4>1.1<tt> </tt><a name="(part._red_subsection)"></a>red subsection</h4>
<h5>1.1.1<tt> </tt><a name="(part._red_subsubsection)"></a>red subsubsection</h5>
...
This problem might also occur for other functions apart from *section.
This issue has been mentioned on Racket Discussions. There might be relevant details there:
https://racket.discourse.group/t/adding-html-attributes-to-scribble-subsubsection/1296/2
I described a workaround here, adding an alt-tag to an elem:
@(define entry-subsection-style
(make-style
#f
(list (alt-tag "h5")
(attributes '((style . "border: none;
padding-top: 0px;
margin-top: 1em;
font-size: 1.4rem;"))))))
@(define (entry-subsection text)
(elem #:style entry-subsection-style text)))
This isn't a "full" workaround though:
- The
alt-tagis HTML-specific, so the structure information gets lost when rendered with LaTeX. - You can't have numbering (although it might be possible with additional workarounds).