You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, custom source markers created with rstudioapi::sourceMarkers() don't appear in the actual source pane like other code diagnostics.
In addition to being helpful for packages like lintr, it would also be a useful approach for calling attention to particular lines of code from within a learnr tutorial or other interactive feedback system. Currently, if the message only appears in the Markers pane the annotations are too disconnected from the source to be effective for learning.
Additionally, #9010 was closed as stale but appears to provide a relatively easy solution to fix the bug that currently prohibits messages with class "html" from being rendered as HTML.
On Mac OS 12.2 with R 4.2 x86_64 and RStudio Desktop 2022.6.0.128, the custom markers show up in both the gutter and the Source Marker pane, but the HTML element styling doesn't render.
For example:
~/test_10062.R
foo <- shiny::HTML('<div style="color:red;">I am red</div>')
bar <- shiny::HTML('<p style="color:red;">I am red</p>')
inherits(foo, "html")
#> [1] TRUE
inherits(bar, "html")
#> [1] TRUE
markers <- list(
list(
type = "error",
file = paste(getwd(), "test_10062.R", sep = "/"),
line = 11,
column = 1,
message = foo),
list(
type = "info",
file = paste(getwd(), "test_10062.R", sep = "/"),
line = 19,
column = 1,
message = bar))
rstudioapi::sourceMarkers("Test Name", markers)
I thought that the text would be rendered in red in the source markers pane and the left gutter.
Same if I use R 4.2 arm 64 version
@jgutman Supporting HTML styling potentially opens up a vulnerability for JS script injection so the alternative is providing ANSI code support. This provides basic formatting like italics, bold, font colours and underlining. Any HTML will be rendered literally. It wasn't mention in this issue so that was my fault for not conveying the result of my conversation with Kevin.
@jgutman Supporting HTML styling potentially opens up a vulnerability for JS script injection so the alternative is providing ANSI code support. This provides basic formatting like italics, bold, font colours and underlining. Any HTML will be rendered literally. It wasn't mention in this issue so that was my fault for not conveying the result of my conversation with Kevin.
Ah okay, makes sense. Is there a way to do the red color styling with ANSI for this example?
Activity
jmcphers commentedon Nov 24, 2021
Consider: These should probably show up in the visual editor, too, if they're inside a code chunk there.
8 remaining items
timtmok commentedon Feb 9, 2022
I'll take a look. It seems that the gutter is not displaying the markers.
timtmok commentedon Feb 9, 2022
I can reproduce the issue using the daily but not in dev. It also seems to work with R arm64 but not if I use x86.
timtmok commentedon Feb 14, 2022
Any build since Friday contains the fix for this.
jgutman commentedon Feb 18, 2022
On Mac OS 12.2 with R 4.2 x86_64 and RStudio Desktop 2022.6.0.128, the custom markers show up in both the gutter and the Source Marker pane, but the HTML element styling doesn't render.
For example:
~/test_10062.RI thought that the text would be rendered in red in the source markers pane and the left gutter.
Same if I use R 4.2 arm 64 version
@timtmok Thoughts?
timtmok commentedon Feb 18, 2022
@jgutman Supporting HTML styling potentially opens up a vulnerability for JS script injection so the alternative is providing ANSI code support. This provides basic formatting like italics, bold, font colours and underlining. Any HTML will be rendered literally. It wasn't mention in this issue so that was my fault for not conveying the result of my conversation with Kevin.
jgutman commentedon Feb 18, 2022
Ah okay, makes sense. Is there a way to do the red color styling with ANSI for this example?
jgutman commentedon Feb 18, 2022
Confirmed this renders properly with