Skip to content

Packages: Blocks and Special pull in StreamMark, Markdig and TextMate for a few components #147

Closed

Description

@239573049

What is wrong

ADR 0050 moved StreamMark, Markdig and TextMate out of TKCode.Arc so that apps which do not render Markdown or highlight code do not carry them. TKCode.Arc.Blocks and TKCode.Arc.Special bring them back for everyone:

  • Both reference TKCode.Arc.Markdown and TKCode.Arc.Highlighting (TKCode.Arc.Blocks.csproj:15-16, TKCode.Arc.Special.csproj:15-16).
  • UseArcBlocks() and UseArcSpecial() depend on UseArcControls().UseArcMarkdown().UseArcHighlighting() (BlocksBuilderExtensions.cs:14, SpecialBuilderExtensions.cs:14).

So an app that uses one block, or one Special component, gets all three libraries. What actually needs them:

  • Special: four of its components, and only to colour code: AskYourData, CodeSuggestion, DesignToCode and InstallSnippet use new MarkdownHighlightPlugin().Highlighter (StreamMark's ISyntaxHighlighter), e.g. Ai/CodeSuggestion/CodeSuggestionHighlighter.cs:16. No Special component renders Markdown.
  • Blocks: the AI chat and answer blocks (through Blocks/Ai/_Shared: AiReplyText, ArenaAnswerView, AiAnswerDocument; Ai/AiChat) and the support blocks (Support/SupportWidget, Screens/InboxSupport/HelpCenter, Screens/InboxSupport/SupportConversation).
  • Highlighting: neither package uses one of its types; the project reference exists only for UseArcHighlighting() in DependsOn.

Also:

  • Blocks/Ai/_Shared/AiAnswerDocument/AiAnswerMarkdown.cs (1319 lines) is a separate Markdown-subset parser, next to TKCode.Arc.Markdown.
  • Blocks references TKCode.Arc.Audio for one block (Media/MediaPlayer). Audio has no dependencies of its own, so this one is cheap and can stay.

Proposal

  1. Code highlighting without Markdown (1.x).
    • Make the highlighting hook in TKCode.Arc public. Today ICodeSyntaxHighlighter and CodeBlockHighlighter (Tables/CodeBlock/CodeBlockSyntax.cs:35,61) are internal. Alternatively, have the four Special components use CodeBlock.
    • Special then drops the Markdown reference. Highlighting becomes optional: code is plain until the app calls UseArcHighlighting(), as it already is for CodeBlock.
  2. Markdown-dependent blocks in their own package (needs decision, 2.0).
    • Move the blocks above into a package such as TKCode.Arc.Blocks.Ai. Blocks then drops Markdown and Highlighting.
    • Moving public types to another assembly is breaking here: Blocks cannot type-forward to a package that depends on it. So this waits for 2.0, unless we decide otherwise.
  3. Migration note. Apps that relied on UseArcSpecial() / UseArcBlocks() to enable Markdown or Highlighting must call those themselves. This goes in the CHANGELOG.
  4. Pin allowed references. Add an architecture test that lists each package's allowed ProjectReferences, so a new one is a deliberate change.

How to check it

  • An app that only calls UseArcSpecial() has no StreamMark, Markdig or TextMate assembly in its publish output (after step 1). The same holds for UseArcBlocks() after step 2.
  • The four Special components highlight code when UseArcHighlighting() is enabled and show plain code otherwise.

Activity

  1. 239573049 commented on Nov 17, 2026

    @239573049
    MemberAuthor

    Done in 1036b9c (#159).

    • TKCode.Arc.Special no longer references TKCode.Arc.Markdown or TKCode.Arc.Highlighting. AskYourData, CodeSuggestion, DesignToCode and InstallSnippet color code through a new internal CodeTokens.CodeTokenHighlighter in TKCode.Arc, which uses CodeBlock's roles and colors.
    • TKCode.Arc.Blocks no longer references TKCode.Arc.Highlighting. It keeps Markdown, which the AI and support blocks render.
    • Migration (in the CHANGELOG): UseArcSpecial() / UseArcBlocks() no longer enable highlighting. Call UseArcHighlighting() to keep colored code. The four Special docs pages say so (Docs for TKCode.Arc 1.2 architecture work: test links, customization line, Special and Mobile notes ArcGallery#12).
    • PackageReferenceTests pins every src project's project and package references.
    • Deferred to 2.0 (2.0: breaking follow-ups from the architecture review #160): moving the Markdown-dependent blocks into their own package, and replacing AiAnswerMarkdown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions