Repository navigation
Source-incompatible changes:
- New enum cases
TextFragment.underline,TextFragment.strikethroughandListType.task(_, checked:):switchstatements over them have to handle the cases. The type of a task item wraps the original one, so useListType.markerto get its bullet or number. CustomBlock,CustomTextFragmentand theTableRendererprotocols refineSendable. Subclasses of parsers and generators get the warning "must restate inherited '@unchecked Sendable' conformance": add@unchecked Sendable.HighlightingConfigandAnsiHighlightingConfigare structs (a changed config has to be avar), andTerminalGenerator.inithas the new parametersunderlinePropertiesandstrikethroughProperties(subclasses overriding it have to adopt them).- Coming from 1.4: see 1.5 below for output changes of the parsers and generators. Also,
SyntaxHighlighter.proxyis astatic let, andHtmlGenerator.init()isinit(safeMode:)(a subclass withoverride init()has to declareinit()withoutoverride).
New features:
FullMarkdownParser(a subclass ofExtendedMarkdownParser) supports all features of MarkdownKit: tables, definition lists, underline (~x~), strikethrough (~~x~~) and task lists (- [ ] to do,- [x] done). The other parsers are unchanged. HTML uses<u>,<del>and<input type="checkbox">, attributed strings ☐ and ☑, and the text generators[ ]and[x].MarkdownText(string:full:…)uses it iffullistrue.- Highlighting themes are parsed and applied like CSS (whitespace, comments,
!important, selectors and specificity). Before, competing rules were merged in a random order and some selector lists were dropped. Text can be bold and italic at once (HighlightingConfig.boldItalicCodeFont), and styling is about 25% faster. - New command-line tool
MarkdownTermViewerprints the demo document ofMarkdownVieweras plain text (--format text, the default) or with ANSI escape codes (--format ansi).
Other changes:
- MarkdownKit is compiled in Swift 6 language mode. Syntax trees, options, configurations, parsers, generators and
SyntaxHighlighterareSendable(e.g. aBlockcan be parsed in a background task); the classes areopenand conform@unchecked.generateAsyncreturnssending NSAttributedString.SyntaxHighlighter.proxycan be used from several threads. NewConcurrencyTests(swift test --sanitize=thread). - Attributed strings: bullets and checkboxes are right-aligned before the text, like numbers (
bulletStyle,checkboxStyle), and a block quote is a single table cell (quoteStyle), because empty cells made text views clip its first lines. - A table without rows has no empty
<tbody>.CustomTextFragmenthas the new requirementsgenerateText(via:)with default implementations. The framework builds for watchOS and tvOS again.