-
Notifications
You must be signed in to change notification settings - Fork 38
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
__ gets lost from labels #53
Comments
ha, interesting! Seems like this is my error in fe63d9e I'm curious no other user encountered it so far! Can you provide a minimized test to reproduce? |
let s = Snippet {
title: Some(Annotation {
label: Some("hello__world"),
id: None,
annotation_type: AnnotationType::Error,
}),
footer: Vec::new(),
slices: Vec::new(),
opt: FormatOptions::default(),
};
eprintln!("{:?}", DisplayList::from(s).to_string()); Prints out |
I see! thank you. I don't have time right now to architect a solution to the problem, so marking as helpwanted. |
I don't see the reason for parsing |
I've added a PR to remove the feature in #54, since the feature was undocumented, and I couldn't figure out what its purpose was. I'd be keen to get something merged, as we use this library in the Rust Starlark library, and it means if a user makes a mistake like typing |
Remove parsing of __ in title strings, fixes #53
The starlark-rust library uses this code, specifically at https://github.com/facebookexperimental/starlark-rust/blob/13bec61a44dd2ec268403e1d6da4401ea76a3f12/starlark/src/errors/mod.rs#L205-L219. The relevant fragment is:
However, if we have a label containing
__
, then that text gets lost from the label. The reason is thatformat_label
inannotate-snippets-rs/src/display_list/from_snippet.rs
Line 56 in 542e41e
__
to apply italics to alternate parts of the label. That behaviour was super surprising. I can't find it documented. There seems to be no way to turn it off, and no way to apply escaping to stop it happening. Can you suggest how I might get it so that errors don't get changed as they are rendered?The text was updated successfully, but these errors were encountered: