Skip to content

Commit c8bdd45

Browse files
committed
Enhance HTML structure and styling by wrapping content in an article tag, adjusting max-width for better layout, and adding h1 font size variable for improved consistency.
1 parent 5e9e210 commit c8bdd45

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

exporters/html/html_export.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,11 @@ def convert_to_html(data: Dict[str, Any], apply_amendments: bool = False, up_to_
236236

237237
# Add the rest of the HTML document
238238
html_doc += f"""
239+
<article>
239240
<h1>{html.escape(rubrik_original)}</h1>
240241
241242
{html_content}
243+
</article>
242244
</body>
243245
</html>"""
244246

@@ -595,7 +597,7 @@ def get_common_styles() -> str:
595597
596598
body {{
597599
font-family: var(--font-primary);
598-
max-width: 1000px;
600+
max-width: 700px;
599601
margin: 0 auto;
600602
padding: 20px;
601603
line-height: 1.6;
@@ -630,6 +632,7 @@ def get_common_styles() -> str:
630632
h1 {{
631633
color: var(--selex-dark-blue);
632634
padding: 15px 0 8px 0;
635+
font-size: var(--h1-font-size);
633636
}}
634637
635638
h2 {{
@@ -645,7 +648,20 @@ def get_common_styles() -> str:
645648
646649
h4 {{
647650
color: #333;
648-
padding: 8px 0 4px 0;
651+
display: inline;
652+
padding-right: 20px;
653+
margin: 0;
654+
font-weight: bold;
655+
}}
656+
657+
/* Make p tags that follow h4 display inline */
658+
h4 + p {{
659+
display: inline;
660+
}}
661+
662+
/* Ensure proper spacing after inline paragraph */
663+
section.paragraf p {{
664+
margin-bottom: 1em;
649665
}}
650666
651667
/* Selex section styling */
@@ -660,7 +676,7 @@ def get_common_styles() -> str:
660676
}}
661677
662678
section.paragraf {{
663-
margin: 0;
679+
margin: 0 0 10px 0;
664680
}}
665681
666682
section[status="upphavd"] {{

exporters/html/styling_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def get_css_variables():
143143
# Add other utility variables
144144
css_vars.append("\n /* Utility variables */")
145145
css_vars.append(" --base-font-size: 16px;")
146+
css_vars.append(" --h1-font-size: 1.5em;")
146147
css_vars.append(f" --font-primary: {FONT_FAMILIES['primary']};")
147148
css_vars.append(f" --font-system: {FONT_FAMILIES['system']};")
148149
css_vars.append(f" --font-modern: {FONT_FAMILIES['modern']};")

0 commit comments

Comments
 (0)