about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2021-07-22 16:46:19 -0700
committerNoah Lev <camelidcamel@gmail.com>2021-08-19 16:22:54 -0700
commit39ef8ea767f6dd953e63f8a0a4828dac37bed50c (patch)
tree6177de1c0c11c94cf949f638c4d087b377594b83 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent7960030d6915a771f5ab72c3897a7ed50c3ed4bd (diff)
downloadrust-39ef8ea767f6dd953e63f8a0a4828dac37bed50c.tar.gz
rust-39ef8ea767f6dd953e63f8a0a4828dac37bed50c.zip
Refactor Markdown length-limited summary implementation
This commit 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.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions