From 0c4ad0ed605f7d8cbfb48599b52cd10f941df57d Mon Sep 17 00:00:00 2001 From: naman-bruno Date: Sat, 3 Jan 2026 20:28:36 +0530 Subject: [PATCH] fix: escape closing tags in genrated docs (#6645) --- .../Collection/GenerateDocumentation/index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/index.js index 6a12d0ef4..cb5e883d4 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/GenerateDocumentation/index.js @@ -3,6 +3,7 @@ import { useSelector } from 'react-redux'; import { cloneDeep } from 'lodash'; import * as FileSaver from 'file-saver'; import jsyaml from 'js-yaml'; +import jsesc from 'jsesc'; import toast from 'react-hot-toast'; import { IconBook, IconCheck, IconAlertTriangle, IconLoader2 } from '@tabler/icons'; @@ -22,10 +23,7 @@ const FEATURES = [ 'Host on any static file server' ]; -const escapeForTemplate = (content) => - content.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\$/g, '\\$'); - -const buildHtmlDocument = (collectionName, yamlContent) => ` +const buildHtmlDocument = (collectionName, escapedYamlContent) => ` @@ -41,7 +39,7 @@ const buildHtmlDocument = (collectionName, yamlContent) => `