-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ansi escapes in custom source markers #12435
Conversation
cc @timtmok or should the
to entirely avoid already structured html, and the risks of js injection it brings. |
Related to #12048, an orthogonal follow up could be to support annotations to carry an html widget. This would be safer as they are wrapped around an |
TODO: this breaks the source markers: Enregistrement.de.l.ecran.2022-12-14.a.13.42.26.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Following up on #10278 I think we have to give up on the |
d4b9135
to
649a225
Compare
Disabled it so that custom source markers can't emit already prepared html content: tmpfile <- "test.R"
foo <- cli::bg_br_white(cli::col_red("I am red!"))
bar <- cli::bg_br_yellow(cli::col_cyan("I am cyan!"))
markers <- list(
list(
type = "error",
file = tmpfile,
line = 6,
column = 1,
message = structure('<i onclick = "alert(42)">I am Groot</i>', class = "html")
),
list(
type = "info",
file = tmpfile,
line = 12,
column = 1,
message = bar))
.rs.api.sourceMarkers("Test Name", markers) gives: markers that we make internally may be html, but I don't think this is used at the moment. We can consider a followup where we would allow creating markers/annotations that would consist of some html widget, that we could embed as an |
* make .rs.scalar() after extrating `html`ness * AceAnnotation.html() * rework LintItem.asAceAnnotations() so that they either have html or text * LintItem may have html or text, not raw * handle AceAnnotation.html * don't treat `class = "html"` in custom source markers
Intent
addresses #12425
Approach
Avoid to create an
AceAnnotation
with both.text
and.html
because otherwise.text
is prefered as per this code in ace:Alternatively, the ace code could use
annotation.html ?
instead ofannotation.text ?
so that the html version would have priority.Automated Tests
QA Notes
Save this file as
test.R
in the current working directory:and then run it.
Expected:
Markers tab:
Annotations:
Checklist
NEWS.md