diff --git a/CHANGELOG.md b/CHANGELOG.md index 3877cab5c..669dc5b87 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). @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Sidebar panel overflow for plugins (#1266, #1269) - Extra border around code output in the instructions panel (#1253) - Line numbering alignment in code blocks in the instructions panel (#1259) +- Extra lines added at the start of some code blocks (#1267) ## [0.33.0] - 2025-10-15 diff --git a/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx b/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx index 9db70ab7e..865de8686 100644 --- a/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx +++ b/src/components/Menus/Sidebar/InstructionsPanel/InstructionsPanel.jsx @@ -27,6 +27,12 @@ const InstructionsPanel = () => { "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)+/, ""); + }); } }, []); const [showModal, setShowModal] = useState(false);