Skip to content

Commit

Permalink
Escape JS
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenpi committed Aug 16, 2019
1 parent 015bad7 commit f4935af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Writers/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const katex_css = "https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.css"

"Provides a namespace for JS dependencies."
module JS
using ....Utilities.JSDependencies: RemoteLibrary, Snippet, RequireJS
using ....Utilities.JSDependencies: RemoteLibrary, Snippet, RequireJS, jsescape
const jquery = RemoteLibrary("jquery", "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js")
const jqueryui = RemoteLibrary("jqueryui", "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js")
const headroom = RemoteLibrary("headroom", "https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js")
Expand Down Expand Up @@ -219,14 +219,15 @@ module JS
))
prepend!(languages, ["julia", "julia-repl"])
for language in languages
language = jsescape(language)
push!(r, RemoteLibrary(
"highlight-$(language)",
"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/$(hljs_version)/languages/$(language).min.js",
deps = ["highlight"]
))
end
push!(r, Snippet(
vcat(["jquery", "highlight"], ["highlight-$(language)" for language in languages]),
vcat(["jquery", "highlight"], ["highlight-$(jsescape(language))" for language in languages]),
["\$", "hljs"],
raw"""
$(document).ready(function() {
Expand Down

0 comments on commit f4935af

Please sign in to comment.