Skip to content

Ensure that the source code display is working with DOS backline #77939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Ensure that the source code display is working with DOS backline
  • Loading branch information
GuillaumeGomez committed Nov 15, 2020
commit 1861a38ca9040c36741fb51f9b22f65228722b13
2 changes: 2 additions & 0 deletions src/librustdoc/html/highlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub fn render_with_highlighting(
playground_button: Option<&str>,
tooltip: Option<(&str, &str)>,
) -> String {
// This replace allows to fix how the code source with DOS backline characters is displayed.
let src = src.replace("\r\n", "\n");
debug!("highlighting: ================\n{}\n==============", src);
let mut out = String::with_capacity(src.len());
if let Some((tooltip, class)) = tooltip {
Expand Down