Repository navigation
Papercut 0.5.0
Pre-release
Pre-release
Added
- Syntax-highlighted code blocks:
CodeBlock::make($code)->language('php')in PHP and<x-doc::pre language="php">in Blade, coloured by a TextMate theme (defaultpapercut-light;theme, orCodeHighlighting(theme: ...)). Highlighting uses the optionalphiki/phiki; without it, or for an unknown language, the block is plain text, and an unknown theme is highlighted with the default one; each is reported as dropped highlighting (strict mode throws). - Code block labels: the language's name in capitals by default,
label="..."for your own text,falseto hide it.text,plaintext,txtandplaingive aTEXTlabel with no colours;nohighlightandno-highlightgive neither. - Code block looks: the default label line,
variant="strip"(label in a header bar) andvariant="caption"(label above the box, rule on the left), withcode-block*named styles. Word export writes shaded paragraphs or tables; HTML writes<pre><code>with coloured spans. PhikiHighlighter::grammar(),theme(),alias()andinjection()register your own TextMate grammars, themes, aliases and VS Code style injection grammars; Laravel reads them frompapercut.code.{theme,variant,grammars,themes,aliases,injections}.<pre><code class="language-x">inMarkup::html()and<x-doc::markup>becomes a code block.MarkupOptions(code: false)orpapercut.markup.highlight = falsekeeps the plainpre.
Changed
- In Word, two horizontal rules in a row are now two rules, as in the PDF, instead of one.
Fixed
- A table whose columns don't fit its box even at their narrowest no longer runs into the margin or off the page. The widest
autoandfrcolumns (and the length columns of a table fromMarkup::html()) are narrowed to a shared width and long words in them break across lines. No column gets narrower than its content can go (cell padding plus its widest letter; a fixed-width box or a nested table keeps the width it needs, while images, SVGs and imported PDF pages scale down). This is reported as approximated, with how much more room the table needed. A table that still can't fit, such as one with hand-set length columns wider than its box, throwsLayoutOverflowin throw mode instead of only warning; clip mode draws it too wide and warns, as before. A header or footer that is laid out only to look ahead, and never drawn, doesn't throw or report. Word export uses the same column widths and reports each table at its own path. - Body text containing
papercut-shd-no longer makes Word export throw. - In Word, a kept-together table (or a kept-together box that Word draws as a table) now stays on one page. Before, each row stayed whole but the table could still break between rows.
- Headings now keep with the block after them, as the docs say. A heading is no longer left alone at the bottom of a page when a keep-together block, table or code block after it moves to the next page. In Word the heading paragraph gets keep-with-next, and in HTML
break-after: avoid. Turn it off on one heading withkeepWithNext(false). When a heading and the block after it can't fit on one page together, the heading still ends up alone.