Skip to content

Add line numbers and line highlight#1254

Merged
rammodhvadia merged 12 commits into
mainfrom
add-line-numbers-and-line-highlight
Oct 10, 2025
Merged

Add line numbers and line highlight#1254
rammodhvadia merged 12 commits into
mainfrom
add-line-numbers-and-line-highlight

Conversation

@rammodhvadia

@rammodhvadia rammodhvadia commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

This PR adds back in the line numbering and line highlighting (used in the editor projects for the projects site). It also fixes some indent issues in projects site editor projects.

Before:
image

After:
Screenshot 2025-10-09 at 14 46 33

The babel plugin added in this PR is the recommended way for webpack (see this post for more info)

Changes:

  • Added babel-plugin-prismjs
  • removed imports for line numbering and highlighting from InstructionsPanel.jsx
  • added config for line highlighting and numbering to .babelrc
  • added normalise whitespace plugin to fix extra line being added at start of code blocks
  • added a config line to InstructionsPanel.jsx to enable manual highlight triggering and configure normalise whitespace plugin to fix indents

Indent fix example:

Before:
Screenshot 2025-10-09 at 14 45 50

After:
Screenshot 2025-10-09 at 14 46 33

@rammodhvadia
rammodhvadia temporarily deployed to previews/1254/merge October 9, 2025 10:33 — with GitHub Actions Inactive
@rammodhvadia
rammodhvadia temporarily deployed to previews/1254/merge October 9, 2025 10:34 — with GitHub Actions Inactive
@rammodhvadia
rammodhvadia temporarily deployed to previews/1254/merge October 9, 2025 10:42 — with GitHub Actions Inactive
@rammodhvadia
rammodhvadia marked this pull request as ready for review October 9, 2025 12:31
@rammodhvadia
rammodhvadia temporarily deployed to previews/1254/merge October 9, 2025 12:45 — with GitHub Actions Inactive
@rammodhvadia
rammodhvadia temporarily deployed to previews/1254/merge October 9, 2025 13:50 — with GitHub Actions Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds line numbering and line highlighting functionality to code blocks in the instructions panel, plus fixes indentation issues. The implementation uses the recommended babel-plugin-prismjs approach for webpack integration.

  • Migrated from manual Prism plugin imports to babel-plugin-prismjs configuration
  • Added line numbers, line highlighting, and normalize-whitespace plugins
  • Configured Prism to run in manual mode with proper whitespace handling

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx Removed manual Prism plugin imports and added configuration for manual highlighting and whitespace normalization
package.json Added babel-plugin-prismjs dependency
CHANGELOG.md Documented the Prism configuration change
.babelrc Added babel-plugin-prismjs configuration with languages, plugins, and theme settings

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx Outdated
Comment thread CHANGELOG.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread .babelrc
Comment on lines +2 to 18
"presets": ["react-app"],
"plugins": [
[
"prismjs",
{
"languages": ["javascript", "css", "python", "html"],
"plugins": [
"line-numbers",
"line-highlight",
"highlight-keywords",
"normalize-whitespace"
],
"theme": "twilight",
"css": true
}
]
]

Copilot AI Oct 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The formatting is inconsistent with the original .babelrc style. The presets array was previously formatted with proper indentation and line breaks. Consider maintaining consistent formatting throughout the file.

Copilot uses AI. Check for mistakes.

@jamiebenstead jamiebenstead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rammodhvadia
rammodhvadia merged commit c98d12e into main Oct 10, 2025
8 checks passed
@rammodhvadia
rammodhvadia deleted the add-line-numbers-and-line-highlight branch October 10, 2025 15:27
@rammodhvadia rammodhvadia mentioned this pull request Oct 13, 2025
@rammodhvadia rammodhvadia mentioned this pull request Oct 13, 2025
rammodhvadia added a commit that referenced this pull request Oct 13, 2025
### Added

- Sidebar plugin functionality (#1251)

### Changed

- Changed `set_pixel` to quantise the colour before writing (#1247)
- Changed Prism config to use babel plugin enabling line highlighting
and numbering (#1254)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Instructions in integrated editor do not have line numbers or highlighting

3 participants