rakutentech / docpub

DocPub is a command line utility for converting a folder structure of markdown files to HTML and uploading the result to Zendesk.
MIT License
12 stars 16 forks source link

In rendered HTML code code is not being highlighted #5

Closed SwinX closed 7 years ago

SwinX commented 7 years ago

Highlight.js markup is being applied, but css is missing from generated HTML. Issued can be fixed in several ways:

corycaywood commented 7 years ago

There can also be an option in docpub.config to enable to enable or disable the highlighter:

rendering: {
    highlight: true || false
}

This will disable both the highlighter in general and adding the link tag.

corycaywood commented 7 years ago

I have found out that Zendesk will strip out all <link> and <style> tags in the body of an article and it even strips out inline style attributes on tags. The tags can be allowed by enabling "Display unsafe content": https://support.zendesk.com/hc/en-us/articles/203664326-Customizing-the-Help-Center#id_gvg_txt_2s

However, allowing unsafe content also allows <script> tags, which could be a security issue.

This means our only choice might be to leave out style automation, and instead include instructions in the documentation on how to add the stylesheet to the Zendesk template.

SwinX commented 7 years ago

I agree that code highlighting is not a good reason to enable unsafe content in general. Suggest following:

  1. Add to config option from above to enable\disable highlighting in general (I mean adding HTML markup for code blocks by highlight.js)
    rendering: {
    highlight: true || false
    }
  2. Add small instruction how to add required stylesheet to ZenDesk theme.

@corycaywood @elliatab what do you think?

corycaywood commented 7 years ago

Yep, I think that's the best we can do.