Fix inline code being rendered as blocks. (#5017)

* Fix inline code being rendered as blocks.

And make blocks non-greedy as well as only scrolling when needed.

* Rename the bubble layout priorities.

* Add an InlineCode attribute so that the builder also strips links from these too.

* Split up the snapshot tests into individual cases.

This should make it much easier to see *what* has changed when regenerating.
This commit is contained in:
Doug
2026-01-28 11:46:13 +00:00
committed by GitHub
parent 3d5269fa19
commit fa200cfedb
67 changed files with 324 additions and 83 deletions
@@ -15,7 +15,8 @@ enum HTMLFixtures: String, CaseIterable {
case textFormatting
case groupedBlockQuotes
case separatedBlockQuotes
case codeBlocks
case code
case wideCodeBlock
case unorderedList
case orderedList
@@ -74,9 +75,9 @@ enum HTMLFixtures: String, CaseIterable {
<blockquote>Some other blockquote</blockquote>\
Text after second blockquote
"""
case .codeBlocks:
case .code:
"""
<pre>A preformatted code block
<pre>A pre-formatted code block
<code>struct ContentView: View {
var body: some View {
VStack {
@@ -88,11 +89,17 @@ enum HTMLFixtures: String, CaseIterable {
.padding()
}
}</code></pre></br>
Followed by some plain code blocks</br>
<code>Hello, world!</code>
<code><b>Hello</b>, <i>world!</i></code>
<code><a href="https://www.matrix.org">This link should not be interpreted as such</a></code>
<code>And this https://www.matrix.org should be not highlighted</code>
Followed by some inline code</br>
<p>Plain text <code>code here</code> more text</p>
<p><code>Hello, world!</code></p>
<p><code><b>Hello</b>, <i>world!</i></code></p>
<p><code>&lt;b&gt;Hello&lt;/b&gt;, &lt;i&gt;world!&lt;/i&gt;</code></p>
<p><code><a href="https://www.matrix.org">This link should not be interpreted as such</a></code></p>
<p><code>And this https://www.matrix.org should be not highlighted</code></p>
"""
case .wideCodeBlock:
"""
<pre><code>CHHapticPattern.mm:487 +[CHHapticPattern patternForKey:error:]: Failed to read pattern library data: Error Domain=NSCocoaErrorDomain Code=260 "The file “hapticpatternlibrary.plist” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Library/Audio/Tunings/Generic/Haptics/Library/hapticpatternlibrary.plist, NSURL=file:///Library/Audio/Tunings/Generic/Haptics/Library/hapticpatternlibrary.plist, NSUnderlyingError=0x600000da69d0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}</code></pre>
"""
case .unorderedList:
"""