Rollup merge of #88173 - camelid:refactor-markdown-length-limit, r=GuillaumeGomez
Refactor Markdown length-limited summary implementation This PR is a new approach to #79749. This PR refactors the implementation of `markdown_summary_with_limit()`, separating the logic of determining when the limit has been reached from the actual rendering process. The main advantage of the new approach is that it guarantees that all HTML tags are closed, whereas the previous implementation could generate tags that were never closed. It also ensures that no empty tags are generated (e.g., `<em></em>`). The new implementation consists of a general-purpose struct `HtmlWithLimit` that manages the length-limiting logic and a function `markdown_summary_with_limit()` that renders Markdown to HTML using the struct. r? `@GuillaumeGomez`
Showing
想要评论请 注册 或 登录