Skip to content

feat(webkit): highlight hcl/terraform and graphql snippets in code-block - #1026

Open
gabriel-lisboa-azion wants to merge 2 commits into
mainfrom
feat/code-block-hcl-graphql
Open

gabriel-lisboa-azion wants to merge 2 commits into
mainfrom
feat/code-block-hcl-graphql

Conversation

@gabriel-lisboa-azion

Copy link
Copy Markdown
Contributor

Summary

  • CodeBlock highlights hcl / terraform / tf: block keywords, attribute keys, calls, strings, literals and # / // comments.
  • CodeBlock highlights graphql / gql: operation and definition keywords, directives, names, fields with arguments, variables, types and # comments.
  • Both reuse the existing seven token types (no new --code-sintax-* token); the spec's language table documents them.

How to test

  1. cd packages/webkit && npx vitest run src/components/data/code-block/code-block.test.ts → 44 tests pass, including "hcl highlighting" and "graphql highlighting".
  2. Render a tab { language: 'hcl', code: 'resource "azion_application" "storefront" {\n name = "storefront"\n}' } → resource in the keyword colour, quoted labels in the string colour, name in the function colour.
  3. Render a tab { language: 'graphql', code: 'query RequestsByStatus($begin: DateTime!) {\n httpMetrics(limit: 100) { status }\n}' } → query is a keyword; RequestsByStatus/httpMetrics use the function colour; $begin/DateTime/100 use the type colour.

Notes

  • Every other language value highlights exactly as before.
  • This PR and the code-block line-entrance fix both touch .specs/code-block.md; whichever merges second rebases and recomputes the spec checksum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant