Skip to content

Code highlight in reprex output not working #187

@renkun-ken

Description

@renkun-ken

Consider the following example:

x <- rnorm(100)
y <- rnorm(100)
m <- lm(y ~ x)
m

In the web browser or in RStudio, the web page looks like

image

In VSCode WebView, the code highlighting is not working:

image

I take a look at the produced reprex_reprex.html and it includes highlight.js library in the form of base64-encoded javascript data uri, which WebView does not seem to support.

<script src="data:application/javascript;base64,LyohIGhpZ2hsaWdodC5qcyB2OS4xMi4wIHwgQlNEMyBMaWNlb...4sazppLGk6IlxcUyJ9fSk7"></script>

I don't find clear documentation or existing issue that says whether this is supported in WebView. Maybe I should file an issue in VSCode repo to ask or in upstream repo to see if they can switch to minified script like jQuery and other libs included in the same file.

PS: It is pandoc that generates the final HTML code, embedding highlight.js in base64 data URI. Looks like we better solve this on our side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions