@box/box-ai-content-answers 2.2.65 → 2.2.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{isBoxDomain}from"../../utils/inlineCitationsUtils.js";import{t as markdown_module_default}from"../../../../chunks/markdown.module.js";import hljs from"highlight.js/lib/common";import{Remarkable}from"remarkable";import '../../../../styles/markdown.css';var md=new Remarkable({breaks:!1,html:!1,linkTarget:`_blank`,typographer:!0,xhtmlOut:!0,highlight(code,language){let addLineNumbers=html=>html.trim().split(/\r?\n/).map((line,index)=>`<div class="${markdown_module_default.hljsLine}"><span class="${markdown_module_default.hljsLineNumber}">${index+1}</span><span class="${markdown_module_default.hljsLineContent}">${line}</span></div>`).join(`
2
- `);try{let highlighted=language&&hljs.getLanguage(language)?hljs.highlight(language,code).value:hljs.highlightAuto(code).value,languageLabel=language&&hljs.getLanguage(language)?language:`auto`;return`<pre class="${markdown_module_default.hljs}" tabindex="0"><span class="${markdown_module_default.hljsLanguage}">${languageLabel}</span><code>${addLineNumbers(highlighted)}</code></pre>`}catch{}return``}});md.renderer.rules.table_open=()=>`<div class="${markdown_module_default.tableWrapper}" tabindex="0"><table>`,md.renderer.rules.table_close=()=>`</table></div>`,md.renderer.rules.link_open=(tokens,idx)=>{let{href}=tokens[idx],result=``,isAllowedLink=!1;try{isAllowedLink=isBoxDomain(href),result=isAllowedLink?`<a href="${href}" target="_blank">`:``}catch{result=``,isAllowedLink=!1}finally{isAllowedLink?md.renderer.rules.link_close=()=>`</a>`:md.renderer.rules.link_close=()=>` (${href})`}return result};var markdownToHtmlString=content=>md.render(content);export{markdownToHtmlString};
1
+ import{isBoxDomain}from"../../utils/inlineCitationsUtils.js";import{t as markdown_module_default}from"../../../../chunks/markdown.module.js";import DOMPurify from"dompurify";import hljs from"highlight.js/lib/common";import{Remarkable}from"remarkable";import '../../../../styles/markdown.css';var md=new Remarkable({breaks:!1,html:!1,linkTarget:`_blank`,typographer:!0,xhtmlOut:!0,highlight(code,language){let addLineNumbers=html=>html.trim().split(/\r?\n/).map((line,index)=>`<div class="${markdown_module_default.hljsLine}"><span class="${markdown_module_default.hljsLineNumber}">${index+1}</span><span class="${markdown_module_default.hljsLineContent}">${line}</span></div>`).join(`
2
+ `);try{let highlighted=language&&hljs.getLanguage(language)?hljs.highlight(language,code).value:hljs.highlightAuto(code).value,languageLabel=language&&hljs.getLanguage(language)?language:`auto`;return`<pre class="${markdown_module_default.hljs}" tabindex="0"><span class="${markdown_module_default.hljsLanguage}">${languageLabel}</span><code>${addLineNumbers(highlighted)}</code></pre>`}catch{}return``}});md.renderer.rules.table_open=()=>`<div class="${markdown_module_default.tableWrapper}" tabindex="0"><table>`,md.renderer.rules.table_close=()=>`</table></div>`,md.renderer.rules.link_open=(tokens,idx)=>{let{href}=tokens[idx],result=``,isAllowedLink=!1;try{isAllowedLink=isBoxDomain(href),result=isAllowedLink?`<a href="${href}" target="_blank">`:``}catch{result=``,isAllowedLink=!1}finally{isAllowedLink?md.renderer.rules.link_close=()=>`</a>`:md.renderer.rules.link_close=()=>` (${href})`}return result};var MARKDOWN_SANITIZE_CONFIG={ALLOWED_TAGS:`a.p.br.hr.strong.em.b.i.del.s.h1.h2.h3.h4.h5.h6.ul.ol.li.blockquote.pre.code.span.div.table.thead.tbody.tr.th.td.sup.sub`.split(`.`),ALLOWED_ATTR:[`href`,`target`,`class`,`tabindex`,`colspan`,`rowspan`,`start`,`title`]},markdownToHtmlString=content=>DOMPurify.sanitize(md.render(content),MARKDOWN_SANITIZE_CONFIG);export{markdownToHtmlString};
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Renders markdown content to HTML string.
3
3
  * This abstraction makes it easier to replace the underlying markdown library in the future.
4
+ * Output is sanitized with DOMPurify before returning (covers AnswerContent and copy-to-clipboard).
4
5
  * @param content - The markdown content to render
5
6
  * @returns The rendered HTML string
6
7
  */
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "2.2.65",
3
+ "version": "2.2.67",
4
4
  "peerDependencies": {
5
- "@box/blueprint-web": "^17.14.0",
6
- "@box/blueprint-web-assets": "^5.10.19",
7
- "@box/box-ai-agent-selector": "^2.2.63",
8
- "@box/item-icon": "^3.5.10",
5
+ "@box/blueprint-web": "^17.14.2",
6
+ "@box/blueprint-web-assets": "^5.10.21",
7
+ "@box/box-ai-agent-selector": "^2.2.65",
8
+ "@box/item-icon": "^3.5.12",
9
9
  "formik": "^2.0.3",
10
10
  "highlight.js": "^11.9.0",
11
11
  "immutable": ">3.0.0",
@@ -16,12 +16,12 @@
16
16
  "remarkable": "^2.0.1"
17
17
  },
18
18
  "devDependencies": {
19
- "@box/babel-plugin-target-attributes": "2.2.21",
20
- "@box/blueprint-web": "^17.14.0",
21
- "@box/blueprint-web-assets": "^5.10.19",
22
- "@box/box-ai-agent-selector": "^2.2.63",
23
- "@box/item-icon": "^3.5.10",
24
- "@box/storybook-utils": "^1.2.63",
19
+ "@box/babel-plugin-target-attributes": "2.2.23",
20
+ "@box/blueprint-web": "^17.14.2",
21
+ "@box/blueprint-web-assets": "^5.10.21",
22
+ "@box/box-ai-agent-selector": "^2.2.65",
23
+ "@box/item-icon": "^3.5.12",
24
+ "@box/storybook-utils": "^1.2.65",
25
25
  "@testing-library/react": "^15.0.6",
26
26
  "immutable": "^3.8.1",
27
27
  "react": "^18.3.0",
@@ -29,6 +29,7 @@
29
29
  "react-intl": "^6.4.2"
30
30
  },
31
31
  "dependencies": {
32
+ "dompurify": "^3.2.0",
32
33
  "react-markdown": "^10.1.0",
33
34
  "remark-gfm": "^4.0.1"
34
35
  },