Skip to content

chore(renderer): deprecate renderMarkdown prop and document actual markdown support #26

@LeslieOA

Description

@LeslieOA

Why

CanvasView declares a renderMarkdown?: (text: string, scheme: ColorScheme) => React.ReactElement prop that no code in the renderer consumes. Tracing it:

  • CanvasView.tsx accepts the prop and passes it into the React context via CanvasProvider
  • CanvasContext.tsx declares the type on the context value
  • Nothing else in src/renderer/** reads it from context

The reason: TextNodeContent (which would have been the consumer) returns null intentionally — there's a comment explaining the choice was made to bypass a react-native-macos rendering limitation where native Text stops rendering beyond ~1500px from the parent View's origin. All text rendering goes through Skia (SkiaTextRendererparagraphBuilder).

So renderMarkdown is vestigial public API. Consumers (e.g. Workspace mobile) pass it in good faith but it has no effect.

What we actually render for text node bodies

Text nodes are parsed by paragraphBuilder.ts which uses the unified/remark ecosystem:

  • remark-parse — CommonMark
  • remark-gfm — strikethrough, tables, task lists
  • remark-frontmatter — YAML (parsed as AST, used for Canvas Candy class extraction, not rendered)
  • hast-util-from-html — inline HTML

Output is a flat list of styled segments rendered via Skia's text API. Supported inline marks: bold, italic, code, links (rendered as styled runs, not as tappable affordances). Supported blocks: headings, paragraphs, lists, code blocks, blockquotes, tables, task lists. Not supported: anything that requires a React component overlay (images embedded in markdown, custom code-block highlighters, callouts beyond what the extensions/callouts.ts layer recognises).

Done means

  • renderMarkdown prop in CanvasView.tsx marked @deprecated with JSDoc explaining the situation and pointing at the actual markdown-rendering pathway
  • Same @deprecated on the field in CanvasContext.tsx
  • README's "What's inside" section gains a brief paragraph on what markdown rendering the renderer actually does (and what it doesn't)
  • No behavioural change — the prop continues to be accepted (and ignored) so existing consumers don't break

Future

Whether to remove the prop entirely is a separate decision — a breaking change. Worth doing eventually, but not in this issue. Document and deprecate first; remove in a later major version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions