From 90f612d8f94f371c83ecb040bf58434b6532410d Mon Sep 17 00:00:00 2001 From: "create-issue-branch[bot]" <53036503+create-issue-branch[bot]@users.noreply.github.com> Date: Fri, 24 Oct 2025 09:11:32 +0000 Subject: [PATCH 1/4] Create draft PR for #1267 From 7c542b9f86ede33e9fceaf925ef2c2ef6d58d868 Mon Sep 17 00:00:00 2001 From: Ram Modhvadia Date: Fri, 24 Oct 2025 12:22:53 +0100 Subject: [PATCH 2/4] add prism hook to remove leading blank lines --- .../Sidebar/InstructionsPanel/InstructionsPanel.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx b/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx index 9db70ab7e..32c2d74a1 100644 --- a/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx +++ b/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx @@ -17,16 +17,25 @@ import RemoveInstructionsModal from "../../../Modals/RemoveInstructionsModal"; import Prism from "prismjs"; import populateMarkdownTemplate from "../../../../utils/populateMarkdownTemplate"; +let prismConfigured = false; + const InstructionsPanel = () => { useEffect(() => { // prism and prism plugin config Prism.manual = true; - if (Prism.plugins.NormalizeWhitespace) { + if (Prism.plugins.NormalizeWhitespace && !prismConfigured) { Prism.plugins.NormalizeWhitespace.setDefaults({ "remove-indent": false, "remove-initial-line-feed": true, "left-trim": false, }); + Prism.hooks.add("before-sanity-check", function (env) { + if (!env.code) return; + + // Remove multiple leading blank lines (empty or whitespace-only) + env.code = env.code.replace(/^(?:\s*\n)+/, ""); + }); + prismConfigured = true; } }, []); const [showModal, setShowModal] = useState(false); From 70ef920e95c6341fffdedd44dfa2b01a9bdc8c7a Mon Sep 17 00:00:00 2001 From: Ram Modhvadia Date: Fri, 24 Oct 2025 12:24:53 +0100 Subject: [PATCH 3/4] update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37a58a2ec..308c56d4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -All notable changes to this project will be documented in this file. +All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Styling design system components used in the web component (#1263) - Sidebar panel overflow for plugins (#1266) +- Extra lines added at the start of some code blocks (#1267) ## [0.33.0] - 2025-10-15 From 2ec76326333e1462789d89fae54ebd4e2f58e47f Mon Sep 17 00:00:00 2001 From: Ram Modhvadia Date: Tue, 4 Nov 2025 15:34:30 +0000 Subject: [PATCH 4/4] remove prismConfigured check as it should not be needed --- .../Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx b/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx index 32c2d74a1..865de8686 100644 --- a/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx +++ b/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx @@ -17,13 +17,11 @@ import RemoveInstructionsModal from "../../../Modals/RemoveInstructionsModal"; import Prism from "prismjs"; import populateMarkdownTemplate from "../../../../utils/populateMarkdownTemplate"; -let prismConfigured = false; - const InstructionsPanel = () => { useEffect(() => { // prism and prism plugin config Prism.manual = true; - if (Prism.plugins.NormalizeWhitespace && !prismConfigured) { + if (Prism.plugins.NormalizeWhitespace) { Prism.plugins.NormalizeWhitespace.setDefaults({ "remove-indent": false, "remove-initial-line-feed": true, @@ -35,7 +33,6 @@ const InstructionsPanel = () => { // Remove multiple leading blank lines (empty or whitespace-only) env.code = env.code.replace(/^(?:\s*\n)+/, ""); }); - prismConfigured = true; } }, []); const [showModal, setShowModal] = useState(false);