mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	markup: improve code block readability and isolate copy button (#34009)
Fix #33197 Improve the rendering of code blocks in markdown content for better readability and UI stability across screen sizes. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		| @@ -15,6 +15,8 @@ export function initMarkupCodeCopy(elMarkup: HTMLElement): void { | ||||
|     const btn = makeCodeCopyButton(); | ||||
|     // remove final trailing newline introduced during HTML rendering | ||||
|     btn.setAttribute('data-clipboard-text', el.textContent.replace(/\r?\n$/, '')); | ||||
|     el.after(btn); | ||||
|     // we only want to use `.code-block-container` if it exists, no matter `.code-block` exists or not. | ||||
|     const btnContainer = el.closest('.code-block-container') ?? el.closest('.code-block'); | ||||
|     btnContainer.append(btn); | ||||
|   }); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 D
					D