Skip to content
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

SQL code blocks disappear #17

Closed
dakvid opened this issue Sep 20, 2018 · 5 comments
Closed

SQL code blocks disappear #17

dakvid opened this issue Sep 20, 2018 · 5 comments

Comments

@dakvid
Copy link

dakvid commented Sep 20, 2018

If I put a code block with SQL:

```sql
SELECT *
FROM my_table
```

the contents disappear from the output. (A code block is there, but there's nothing in it.)

It doesn't appear to be SQL specific. There appears to be a list of languages that work (including r, c, cpp, java, python, julia, javascript, css) but anything else (sql, rust, haskell, d, brainfuck, ...) disappears.

@epspi
Copy link

epspi commented Sep 21, 2018

Source

https://github.com/rstudio/radix/blob/27b482a21b6cba1c21752abdcd6b55ff5e083218/inst/rmarkdown/templates/radix_article/resources/distill.html#L575

image

Details

The pre element within the d-code block tag is missing for the sql chunk but present for the chunks that render correctly. A child of pre that's supposed to contain the code (code id="code-container") is actually there but

  1. it has nothing in it and
  2. it doesn't carry a language class

image

Results for R

<pre>
    <code id="code-container" class="language-clike">
        data <span class="token operator">&lt;</span>
        <span class="token operator">-</span> iris
    </code>
</pre>

Results for Sql

<code id="code-container"></code>

@jjallaire
Copy link
Member

Fixed via rstudio/radix@868669f

Our only option here was to map languages not supported directly by Prism to "clike"

@dakvid
Copy link
Author

dakvid commented Sep 22, 2018

I'm a little confused, apologies if I'm misunderstanding something at some point. :-)

Prism.js supports 152 languages, including R and SQL: https://prismjs.com/#languages-list

However, looking at the source of template/src/components/d-code.js from distill, they only explicitly import python, clike, lua, bash, go, markdown and julia. So this could be fixed "properly" by importing more languages - but is this something that radix could override, or would it need a pull request to distill?

@jjallaire
Copy link
Member

We'd have to remove the embedded Prism from Distill then replace it with another implementation. So far we've taken the approach not to fork/edit Distill but it may be that we'll ultimately need to.

@jjallaire jjallaire reopened this Sep 22, 2018
@jjallaire
Copy link
Member

Going to close this and create a new issue covering adding more Prism languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants