mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	| @@ -1,4 +1,4 @@ | ||||
| import {htmlEscape} from 'escape-goat'; | ||||
| import {html, htmlRaw} from '../utils/html.ts'; | ||||
|  | ||||
| type Processor = (el: HTMLElement) => string | HTMLElement | void; | ||||
|  | ||||
| @@ -38,10 +38,10 @@ function prepareProcessors(ctx:ProcessorContext): Processors { | ||||
|     IMG(el: HTMLElement) { | ||||
|       const alt = el.getAttribute('alt') || 'image'; | ||||
|       const src = el.getAttribute('src'); | ||||
|       const widthAttr = el.hasAttribute('width') ? ` width="${htmlEscape(el.getAttribute('width') || '')}"` : ''; | ||||
|       const heightAttr = el.hasAttribute('height') ? ` height="${htmlEscape(el.getAttribute('height') || '')}"` : ''; | ||||
|       const widthAttr = el.hasAttribute('width') ? htmlRaw` width="${el.getAttribute('width') || ''}"` : ''; | ||||
|       const heightAttr = el.hasAttribute('height') ? htmlRaw` height="${el.getAttribute('height') || ''}"` : ''; | ||||
|       if (widthAttr || heightAttr) { | ||||
|         return `<img alt="${htmlEscape(alt)}"${widthAttr}${heightAttr} src="${htmlEscape(src)}">`; | ||||
|         return html`<img alt="${alt}"${widthAttr}${heightAttr} src="${src}">`; | ||||
|       } | ||||
|       return ``; | ||||
|     }, | ||||
|   | ||||
| @@ -2,6 +2,7 @@ import {isDarkTheme} from '../utils.ts'; | ||||
| import {makeCodeCopyButton} from './codecopy.ts'; | ||||
| import {displayError} from './common.ts'; | ||||
| import {queryElems} from '../utils/dom.ts'; | ||||
| import {html, htmlRaw} from '../utils/html.ts'; | ||||
|  | ||||
| const {mermaidMaxSourceCharacters} = window.config; | ||||
|  | ||||
| @@ -46,7 +47,7 @@ export async function initMarkupCodeMermaid(elMarkup: HTMLElement): Promise<void | ||||
|  | ||||
|       const iframe = document.createElement('iframe'); | ||||
|       iframe.classList.add('markup-content-iframe', 'tw-invisible'); | ||||
|       iframe.srcdoc = `<html><head><style>${iframeCss}</style></head><body>${svg}</body></html>`; | ||||
|       iframe.srcdoc = html`<html><head><style>${htmlRaw(iframeCss)}</style></head><body>${htmlRaw(svg)}</body></html>`; | ||||
|  | ||||
|       const mermaidBlock = document.createElement('div'); | ||||
|       mermaidBlock.classList.add('mermaid-block', 'is-loading', 'tw-hidden'); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 wxiaoguang
					wxiaoguang