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.
14 lines
275 B
Rust
14 lines
275 B
Rust
crate mod escape;
|
|
crate mod format;
|
|
crate mod highlight;
|
|
crate mod layout;
|
|
mod length_limit;
|
|
// used by the error-index generator, so it needs to be public
|
|
pub mod markdown;
|
|
crate mod render;
|
|
crate mod sources;
|
|
crate mod static_files;
|
|
crate mod toc;
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|