microsoft / BotFramework-WebChat

A highly-customizable web-based client for Azure Bot Services.
https://www.botframework.com/
MIT License
1.6k stars 1.55k forks source link

Add HTML content transformer middleware #5338

Closed compulim closed 2 weeks ago

compulim commented 3 weeks ago

Fixes #

Changelog Entry

Breaking changes

Added

Description

Refactored part of renderMarkdown into HTML content transformer: sanitizer and copy button.

This is to support code blocks syntax highlighting (#5335) in Markdown. Another PR will bring syntax highlighting to Markdown fenced code blocks shortly.

Design

Today, our renderMarkdown do a couple of things:

In this PR, we are refactoring the "copy button" and HTML sanitizer into a middleware of their own. We will port "better link" later.

This will help web devs who customized renderMarkdown to sanitize the output HTML without additional efforts. Web devs can bring their own HTML sanitizer.

Specific Changes

Review Checklist

This section is for contributors to review your work.