Repository navigation
feat(markdown): add Labeled blocks, programmatic Document builder, and spatial paint index - #70
Merged
Merged
Conversation
…d spatial paint index
Author
|
Upstream PR: vivaui#489 |
32 of 35 tasks
added 2 commits
November 28, 2026 00:13
Mucheen
marked this pull request as ready for review
November 27, 2026 22:58
Mucheen
added a commit
to Mucheen/Lithe-IDEA
that referenced
this pull request
Nov 28, 2026
Includes Lithe-IDEA/Lithe-viva#70 and 1lck#73 (empty code line hit-test fix in MarkdownView offsetAtIndexed and dense-grid linear equivalence tests).
Mucheen
added a commit
to 1lck/Lithe-IDEA
that referenced
this pull request
Nov 28, 2026
* feat(editor): render HTML, Javadoc, and Markdown doc comments natively (#2475) * fix(editor): address code review findings and update Core/Viva pins * fix(editor): address Devin Review edge cases for selection, anchors, PageUp, long-line scan, and bulk toggles * fix(editor): keep Render All enabled after FoldAll and harden doc block drag selection boundary * fix(editor): keep word and line drags from overshooting past rendered doc blocks * chore(desktop): bump pinned Lithe-viva to main commit 6b89cf2a33b1 Includes Lithe-IDEA/Lithe-viva#70 and #73 (empty code line hit-test fix in MarkdownView offsetAtIndexed and dense-grid linear equivalence tests).
This was referenced Nov 29, 2026
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.
What this changes
markdown/markdown.go&markdown/builder.go:Labeledblock kind (labelLo/labelHi,Document.LabelSpans) for aligned key/value or metadata sections without hardcoding any domain-specific tag semantics.markdown.Document(Reset,AppendParagraph,AppendHeading,AppendItem,AppendCode,AppendRule,AppendLabeled,AppendTable, andAllocatedBytes) so host applications with pre-parsed structured IR can populatemarkdown.Documentdirectly without re-serializing to Markdown text.components/markdown.go,components/markdown_index.go,components/markdown_index_test.go,components/doc_test.go:markdown.Labeledblocks with a shared aligned label column width measured across consecutive labeled blocks.blockSpans→tableRows→cellSpans→rowSpans), depth-bucketed disjoint quote-bar index (quoteBarIdx[8]), and an independentplainPiecesbinary-search index forCaretAt, while preserving original reading order acrosspieces,plain,boxes,links, andimages.MarkdownView.AllocatedBytes()andMarkdownView.BlockAnchorTop(blockIndex)for cache-budget accounting and local section anchor navigation.markdown_index.goindocPrimaryEntries(components/doc_test.go).Why
Applications embedding native rich-text documentation (such as rendered documentation comments and quick-doc popups with large tables, long blockquotes, and aligned metadata rows like
Since:/See also:/Author:/Type parameters:) need:markdown.Documentpopulation without round-tripping through Markdown syntax.PaintandCaretAtlookups even for tall table cells or multi-hundred-paragraph quote blocks, plus deterministic memory accounting and top-level block anchor coordinates.How it was verified
gofmt -lover modified/added Go files (clean)go vet ./...(passed)go test ./markdown/... ./components/... -count=1(passed, includingTestDocCatalogCoversEveryComponent,Labeledalignment, opaque links, 1-row 1,100-line tall table cell, and 600-paragraph quote bar tests)GOOS=windows GOARCH=amd64 go build ./...andGOOS=windows GOARCH=arm64 go build ./...(passed)components/markdown_index_test.go, Apple M5,go test -run '^$' -bench '^BenchmarkMarkdownViewClippedPaintSteady' -benchmem -count 3 -benchtime 200ms ./components):BenchmarkMarkdownViewClippedPaintSteady: ~1.77 µs/op (1596–2104 ns/op), 0 B/op, 0 allocs/op over a clipped viewport in a large mixed document with tall tables and blockquotes.Visual evidence
MarkdownViewlayout formarkdown.Labeledaligned two-column rows and clipped painting of large documents.markdown.DocumentviaAppendLabeled/AppendParagraph/AppendCode/AppendTableand painting viacomponents.MarkdownView.TestMarkdownViewLabeledAlignment,TestMarkdownViewTallTableCellFourLevelIndex,TestMarkdownViewDeepQuoteBarSpatialIndex,TestMarkdownViewBlockAnchorTop, andBenchmarkMarkdownViewClippedPaintSteadyincomponents/markdown_index_test.go.Where the boundary sits
Generic document primitives (
Labeledtwo-column blocks, programmaticmarkdown.Documentbuilder, clipped spatial indexing,AllocatedBytes, andBlockAnchorTop) belong in Viva's reusablemarkdownandcomponentspackages. All HTML/Javadoc/Markdown parsing, language-specific tag localization, and editor projection stay in the host application and Rust Core.Cost
Programs that do not construct
Labeledblocks or callAppend*/BlockAnchorToppay zero extra per-frame cost; steady-state clippedPaintstays 0 B/op, 0 allocs/op. The spatial index stores compact integer span slices built once duringLayoutand accounted for inAllocatedBytes().