fix: test strings, logical sides in the PDF markdown styles, one export per markdown module

This commit is contained in:
Maurice
2026-10-24 08:46:22 +02:00
parent a0554c2346
commit 0534d7b3a7
8 changed files with 44 additions and 51 deletions
+2 -7
View File
@@ -399,13 +399,8 @@ describe('downloadTripPDF', () => {
// #2692: a place's description and notes print as the planner shows them, not as raw markdown.
it('FE-COMP-TRIPPDF-016c: renders markdown in a place description, sanitized', async () => {
const place = { ...placeWithDetails, description: '**Colosseum** tickets
| Gate | Time |
| --- | --- |
| A | 9:00 |
<script>alert(1)</script>' }
const description = ['**Colosseum** tickets', '', '| Gate | Time |', '| --- | --- |', '| A | 9:00 |', '', '<script>alert(1)</script>'].join('\n')
const place = { ...placeWithDetails, description }
const md = { ...richArgs, places: [place], assignments: { '10': [{ ...assignmentForDay, place }] } }
await downloadTripPDF(md as any)
const html = getIframe()!.srcdoc
+5 -5
View File
@@ -24,7 +24,7 @@ import { fetchExchangeRates } from '../../hooks/useExchangeRates'
import { getFlightLegs, getTrainLegs, usesStationRoute } from '../../utils/flightLegs'
import { isServiceStopType } from '../Roadtrip/roadtripModel'
import { onlyMyPlan } from './pdfScope'
import { createMarkdownHtml } from '../shared/SafeMarkdown'
import { createMarkdownHtml } from '../shared/markdownHtml'
/**
* Every day starts a new page by default. On a trip of short days that prints
@@ -845,13 +845,13 @@ export async function downloadTripPDF({ trip, days, places, assignments: allStor
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md table, .md blockquote, .md pre { margin: 0 0 4px; }
.md ul, .md ol { padding-left: 14px; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-size: 10px; font-weight: 700; color: #475569; margin: 4px 0 2px; }
.md ul, .md ol { padding-inline-start: 14px; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-size: 1.1em; font-weight: 700; margin: 4px 0 2px; }
.md table { border-collapse: collapse; }
.md th, .md td { border: 1px solid #e2e8f0; padding: 2px 5px; text-align: left; }
.md th, .md td { border: 1px solid #e2e8f0; padding: 2px 5px; text-align: start; }
.md code { font-family: ui-monospace, monospace; font-size: 8.5px; }
.md a { color: inherit; text-decoration: underline; }
.md blockquote { border-left: 2px solid #e2e8f0; padding-left: 6px; }
.md blockquote { border-inline-start: 2px solid #e2e8f0; padding-inline-start: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; padding-left: 21px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 3px; font-size: 8px; font-weight: 600; background: #f1f5f9; color: #374151; border-radius: 99px; padding: 2px 7px; white-space: nowrap; }