Skip to content

MarkdownWidget: Add syntax highlighting for fenced code blocks #240

@mitchdenny

Description

@mitchdenny

Summary

Fenced code blocks in the MarkdownWidget currently render as read-only EditorWidget instances with line numbers but no syntax highlighting. The language info string (e.g. ```csharp) is parsed and available via FencedCodeBlock.Language` but not yet used for colorization.

Proposed Approach

Integrate with the Editor widget's language server / tokenization infrastructure (see #165) to provide syntax-aware highlighting. This would involve:

  1. Mapping the markdown language tag to an editor language mode
  2. Applying token-based styling to the read-only editor content
  3. Falling back to plain text when no language mode is available

Dependencies

Current State

  • FencedCodeBlock.Language is already parsed and stored
  • Code blocks render via MarkdownCodeBlockWidget wrapping EditorWidget in read-only mode
  • Line numbers are shown; scroll bindings are removed so parent scroll panels work correctly

Labels

Enhancement, MarkdownWidget

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions