Skip to content

feat(search): Display matched search terms with context highlighting #128

@vredchenko

Description

@vredchenko

Summary

Highlight matched search terms within surrounding context text in results.

Implementation

For Documentation (MiniSearch)

  • Extract ~50 characters before/after matched terms
  • Display as snippet in result item

For GitHub API

  • Use text_matches field with header: Accept: application/vnd.github.text-match+json
  • GitHub provides pre-computed fragments with match info

UI

  • Render snippets with <mark> tags for visual emphasis
  • Style highlighted terms distinctly

Files to Modify

  • webui/src/hooks/useSearch.ts (snippet extraction)
  • webui/src/types/search.ts (add snippet field)
  • webui/src/components/widgets/SearchPalette/SearchPalette.tsx (display)
  • webui/src/components/widgets/SearchPalette/SearchPalette.css (styling)

From PR #124 review comment (Item 12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    developmentNew features or functionality implementationenhancementMinor improvements to existing functionalitysmartem-devtools:webuiDeveloper dashboard web interface

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions