Repository navigation
Conversation
Resolves the audit in #11. Every changed line is a comment; no behaviour changes. Corrects claims that were false against the code: - BlockParser was documented as "top-level only", with recursion attributed to MarkdownListView. It recurses into lists and block quotes itself, and MarkdownListView never calls it. Verified: nested bullets produce a model 3 levels deep, 40 nested block quotes produce 40. The replacement carries the unbounded-depth warning, since this is where the crash in #8 lives. - MarkdownListView documented a `listDepth` property it does not have. - MarkdownStyle.textPrimary claimed headings and body text; only table cells use it. radiusSmall claimed inline code chips; only the code block container uses it. - The MarkdownStyle initializer told adopters to use `MarkdownStyle.runBot`, which does not exist in this package. - MarkdownCodeBlockView.language claimed a lowercased identifier. Nothing lowercases it. Verified that highlight.js matches case-insensitively, so the doc was fixed rather than the code. - MarkdownCodeBlockView and MarkdownHighlighter both claimed an unknown language yields nil. Verified it does not — highlight.js auto-detects. - InlineTextView justified its AttributedString design by a macOS 26 deprecation; the floor is macOS 13. - MarkdownRenderLog was described as internal while exporting public API. - MarkdownTableView documented a 220 pt cap defined in another file. - A detector boundary case credited the cubic bypass for a pass that clears the density floor on its own (5/15 = 0.333). Case 4 is the only one that isolates the bypass; both now say so. Removes references that cannot be resolved from this repository: 20 file headers naming RunBot, ten comments describing RunBot internals, five issue numbers from another tracker, and four symbols that live elsewhere. Two doc comments addressed a code reviewer rather than a caller and shipped in DocC; both now state the underlying fact instead. Adds comments where behaviour is genuinely surprising: the coupled "plaintext" fallback shared by MarkdownCodeBlockView and HighlightPrewarmer, where divergence would silently make prewarming a no-op; links that keep accent colour while being inert; the clear-underline workaround; silent cell truncation in MarkdownTableModel; the three AppKit defaults that make the package macOS-only; and what pins the macOS 13 floor. Deletes six identical "see type-level doc for rendering contract" body comments and gives the types they pointed at an actual contract. Refs #11
Greptile SummaryThis documentation-only PR corrects stale or inaccurate comments, removes product-specific provenance, and documents several non-obvious parser, highlighter, rendering, and platform constraints.
Confidence Score: 5/5The PR appears safe to merge because it changes comments only and no concrete inaccurate or behavior-affecting change remains. The updated documentation is consistent with the inspected parsing, rendering, detection, styling, table, and highlighting paths, with no accepted blocking or non-blocking findings.
|
| Filename | Overview |
|---|---|
| Package.swift | Documents the macOS 13 deployment floor and rationale for revision-pinned dependencies without changing package configuration. |
| Sources/MarkdownKit/MarkdownDocumentView.swift | Corrects parser recursion documentation and records cancellation and deep-input stack limitations. |
| Sources/MarkdownKit/Highlighting/MarkdownHighlighter.swift | Clarifies unknown-language auto-detection, failure fallback, and bounded-cache behavior. |
| Sources/MarkdownKit/Rendering/MarkdownCodeBlockView.swift | Documents verbatim language handling, plaintext fallback selection, and cache-key alignment with prewarming. |
| Sources/MarkdownKit/Rendering/MarkdownInlineRenderer.swift | Clarifies attributed-text intent handling, safe link activation, and underline suppression. |
| Sources/MarkdownKit/Styling/MarkdownStyle.swift | Corrects token usage documentation and identifies the AppKit-derived color defaults relevant to portability. |
| Sources/MarkdownKit/Model/MarkdownTableModel.swift | Documents delimiter-defined table width and silent normalization of ragged rows. |
| Tests/MarkdownKitTests/MarkdownDetectorTests.swift | Corrects comments identifying which detector boundary case uniquely exercises the cubic bypass. |
Reviews (1): Last reviewed commit: "docs: fix stale and incorrect code comme..." | Re-trigger Greptile
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves the audit in #11.
Every changed line in this PR is a comment. The only non-comment line in the diff gains a trailing comment; nothing else moves. All 17 tests pass, build is clean with no warnings.
Note
Stacked on #9, so this PR targets
fix/safe-hardening-and-platform-floorrather thanmain. Three of the fixes (the macOS 13 floor references) only make sense on top of that branch. Retarget tomainonce #9 merges.What changed
Nine false claims corrected
BlockParsertype docMarkdownListView"parserecurses into itself;MarkdownListViewnever calls itMarkdownListViewtype doclistDepth"depth;listDepthis the outgoing argument labelMarkdownStyle.textPrimaryMarkdownStyle.radiusSmallMarkdownStyle.initMarkdownStyle.runBot… rather than constructing a value directly"MarkdownCodeBlockView.languageMarkdownCodeBlockView/MarkdownHighlighternilon "unknown language"nilInlineTextViewtype docMarkdownRenderLogrenderLogKindextensions are public APIMarkdownTableViewMarkdownTableCellViewMarkdownDetectorTestscase 2Verified, not assumed
Three of those were checked by running the code rather than reading it:
BlockParserrecursion — parsing- outer / - inner / - deepestyields a model 3 levels deep; 40 nested>markers yield 40. Both built entirely insideBlockParser.parse.Fence-language casing — #11 §3.6 left this open as a behaviour decision. Resolved as a doc fix, because
"SWIFT","Swift"and"swift"produce byte-identical highlighted output; highlight.js matches case-insensitively. No code change was needed.That probe also turned up a finding the audit missed:
"bogus-lang"does not returnnil— it comes back with 6 coloured runs, distinct from bothplaintextandswift. highlight.js auto-detects when it doesn't recognise a name. So two comments promising anil-on-unknown-language path were describing a branch that is never taken, and the?? "plaintext"fallback in both call sites turns out to be load-bearing: it's what stops untagged output from being auto-detected as some guessed syntax. Both now say so.Detector boundary case 2 — against the running detector:
Case 2 passes on density; it does not isolate the cubic bypass the comment credited. Case 4 is the only one of the six that does — and it now says "retune the cubic constant and this is the case that moves."
Provenance and dead references removed
20 file headers naming RunBot, ten comments describing RunBot internals, five issue numbers from another tracker (
#2379,#2394,#2600,#2731,#2740), and four symbols that live elsewhere (cleanLogText,StepLogView.loadLog(),MarkdownLogView,MarkdownStyle+RunBot.swift). Also"Option A"and"per repository policy", neither of which named anything findable in this repo.Each comment's rule was kept; only its RunBot instance was dropped. The ANSI-stripping precondition on
MarkdownDetector, for instance, is a real contract the package can't enforce, so it stays — minus the migration plan for another repo's refactor.Review directives removed from public API docs
Two doc comments addressed a code reviewer, and both shipped in DocC and Xcode Quick Help:
Both now state the underlying fact for a caller instead. Relatedly, the auto-enable gate was described in three places in
MarkdownDetector— which is how one of them drifted, and howDetectResult's copy came to omit thescore >= 3floor.detect(_:)is now the single description; the other two point at it.Comments added where behaviour is surprising
MarkdownCodeBlockView↔HighlightPrewarmer— both compute the cache-key language independently. The cache key holds the raw string, so any divergence makes every prewarmed entry miss and silently turns prewarming into an expensive no-op. Both sites now say to keep them identical.BlockParser.parse— recursion depth is bounded only by input, and aTask's cooperative stack is much smaller than the main thread's, soparseAsyncoverflows shallower. This is the warning that the old "top-level only" comment displaced.parseAsync— does not checkTask.isCancelled, though DESIGN.md asks callers to respect cancellation. Now stated, matching howpreWarmHighlighteralready documents its own behaviour.javascript:link looks exactly like a working one. Marked as the deliberate trade-off it is.AttributedStringauto-underlines.linkruns with no way to disable it, so the underline is drawn in clear. Reads like a mistake without the note.parseCells— pads short rows and silently drops cells past the delimiter width. Only the padding direction was documented or tested.Color(nsColor:)defaults — withimport AppKit, the entire iOS blocker.Package.swift— macOS 13 is set by SwiftUIGrid; v12 fails on that symbol alone.Boilerplate removed
Six identical
/// SwiftUI view body — see type-level doc for rendering contract.comments, on views whose type docs mostly had no contract to see. Deleted, and the type docs they pointed at now state one —MarkdownListViewexplains how nesting is actually resolved,MarkdownTableCellViewexplains the width cap.Deliberately not done
MarkdownTableCellView:31(Code comment audit: stale RunBot provenance, nine false claims, and the comments worth adding #11 §5.9) is commented, not extracted. Extracting it is provably equivalent over all fourColumnAlignmentcases, but it would be the only behaviour-touching line in the PR and break the "comments only" guarantee. Worth its own one-line change.MarkdownHighlightercache — the comment claiming no measurement exists now cites the ~54 µs figure from Package assessment: correctness, performance, platform reach, and packaging #8 §2.2. Replacing the linear scan stays with Package assessment: correctness, performance, platform reach, and packaging #8.Refs #11