mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
A card's description, its comments and its checklist items are markdown, and WeKan draws them as markdown everywhere it shows them. The exports did not: the PDF flattened `**bold**` to the word with its asterisks still attached, and Excel wrote the source text into a cell. A card that reads well on screen exported as something nobody would write on purpose - #6586, "markdown is not formatted - this doesn't make sense in a pdf file, does it?" models/lib/exportMarkdown.js parses it with THE SAME markdown-it options the reader's renderer uses - html, linkify, typographer, breaks - so the export and the screen agree about what is emphasis, what is a list and where a paragraph ends. It answers in a shape neither exporter is: blocks carrying runs of styled text, `{ text, bold, italic, code, strike, link }`. Excel turns runs into an ExcelJS richText array; the PDF will pick one of its four Courier faces. Neither has to know markdown, and a fix to how a list nests reaches both at once - which is the whole reason there is one module rather than two. HTML in a card is kept as TEXT, deliberately. An export is a document, and a card containing a script tag should put those characters in the file rather than have anything act on them. Wired into the Excel card export's description first, where a single unstyled run is still written as a plain string - so a card with no markdown in it produces exactly the file it did before. AND THE PLAN FOR THE REST IS WRITTEN DOWN, because the request is one rule: the same functions, layouts and templates for every PDF and Excel export, with no duplicated code. docs/Features/ImportExport/One-Card-Layout.md says what that means and in what order it lands. Two of the four quarters are already true, and by the same method - one renderer, called by every scope. Excel draws the card layout at every scope (ExporterExcelBoard renders each card through ExporterExcelCard.renderCardBlock), and the PDF already shares one block across scopes (ExporterBoardPDF and ExporterCardPDF both render through PDFExporterBase.cardBlockLines). What is missing is that the PDF's block is not that LAYOUT: monospaced lines, no sections, no label columns, no boxes, no images. So the next step is not "make the PDF look like the Excel code". It is a card DOCUMENT - one description of the layout, built once from a card, rendered twice - with the Excel renderer moved onto it first, unchanged output being what makes that step verifiable, and the PDF renderer and its images following. Thanks to Heart1010 and xet7 !