-
Notifications
You must be signed in to change notification settings - Fork 1
Fix nested blockquote parsing, drawn quote bars, and phantom list-item spacing #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ronaldmannak
merged 9 commits into
main
from
claude/code-block-syntax-highlighting-g6l056
Jul 7, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0fcd93c
fix: render nested blockquotes and remove phantom blank line after st…
claude 63f3f89
fix: marker-only '>' lines split quotes and return to the outer level
claude adc1f07
feat: draw real blockquote bars instead of gluing '│' glyphs into the…
claude 714c720
fix: preserve custom bar attributes through AttributedString conversions
claude 09c1d97
test: avoid trailing periods in marker-only quote goldens
claude cee78e0
fix: iOS strict-concurrency error + Codex review findings on quote se…
claude 7ce527f
fix: continuous quote bars across blocks + Codex streaming/content fi…
claude a1681f6
fix: sync refreshed parent records into text storage on child insertion
claude 926f732
fix: CommonMark padded nested markers, clean separator events, conten…
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
Sources/PicoMarkdownView/Renderer/PicoAttributeScope.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import Foundation | ||
|
|
||
| #if canImport(UIKit) | ||
| import UIKit | ||
| #elseif canImport(AppKit) | ||
| import AppKit | ||
| #endif | ||
|
|
||
| /// Typed keys for PicoMarkdownView's custom attributes. | ||
| /// | ||
| /// `AttributedString`'s plain conversion initializers silently drop any | ||
| /// `NSAttributedString.Key` that isn't part of a registered attribute scope. | ||
| /// The rendering pipeline converts between `NSAttributedString` and | ||
| /// `AttributedString` at its seams, so every conversion that must keep these | ||
| /// attributes goes through the `picoConverted(from:)` helpers below. | ||
|
|
||
| /// 1-based blockquote nesting level (see `BlockquoteBarDecoration`). | ||
| enum PicoBlockquoteLevelAttribute: ObjectiveCConvertibleAttributedStringKey { | ||
| typealias Value = Int | ||
| typealias ObjectiveCValue = NSNumber | ||
| static let name = NSAttributedString.Key.picoBlockquoteLevel.rawValue | ||
|
|
||
| static func objectiveCValue(for value: Int) throws -> NSNumber { | ||
| NSNumber(value: value) | ||
| } | ||
|
|
||
| static func value(for object: NSNumber) throws -> Int { | ||
| object.intValue | ||
| } | ||
| } | ||
|
|
||
| /// Platform color for drawn blockquote bars. | ||
| enum PicoBlockquoteBarColorAttribute: ObjectiveCConvertibleAttributedStringKey { | ||
| typealias Value = MarkdownColor | ||
| typealias ObjectiveCValue = MarkdownColor | ||
| static let name = NSAttributedString.Key.picoBlockquoteBarColor.rawValue | ||
|
|
||
| static func objectiveCValue(for value: MarkdownColor) throws -> MarkdownColor { | ||
| value | ||
| } | ||
|
|
||
| static func value(for object: MarkdownColor) throws -> MarkdownColor { | ||
| object | ||
| } | ||
| } | ||
|
|
||
| extension AttributeScopes { | ||
| /// PicoMarkdownView's attribute scope: the custom keys plus the platform | ||
| /// and Foundation scopes, so scoped conversions keep standard attributes | ||
| /// (fonts, colors, paragraph styles, links, attachments) as well. | ||
| struct PicoMarkdownAttributes: AttributeScope { | ||
| let blockquoteLevel: PicoBlockquoteLevelAttribute | ||
| let blockquoteBarColor: PicoBlockquoteBarColorAttribute | ||
| #if canImport(UIKit) | ||
| let uiKit: UIKitAttributes | ||
| #elseif canImport(AppKit) | ||
| let appKit: AppKitAttributes | ||
| #endif | ||
| let foundation: FoundationAttributes | ||
| } | ||
|
|
||
| var picoMarkdown: PicoMarkdownAttributes.Type { PicoMarkdownAttributes.self } | ||
| } | ||
|
|
||
| extension AttributedString { | ||
| /// Conversion that preserves PicoMarkdownView's custom attributes. | ||
| static func picoConverted(from attributed: NSAttributedString) -> AttributedString { | ||
| (try? AttributedString(attributed, including: \.picoMarkdown)) ?? AttributedString(attributed) | ||
| } | ||
| } | ||
|
|
||
| extension NSAttributedString { | ||
| /// Conversion that preserves PicoMarkdownView's custom attributes. | ||
| static func picoConverted(from content: AttributedString) -> NSAttributedString { | ||
| (try? NSAttributedString(content, including: \.picoMarkdown)) ?? NSAttributedString(content) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.