It is only me, or the site is not highlighting the code now?
function test(x)
return x + 1
end
It is only me, or the site is not highlighting the code now?
function test(x)
return x + 1
end
These errors from the browser console is probably related:
13:13:57.974 Failed to load āhttps://sea2.discourse-cdn.com/julialang/highlight-js/discourse.julialang.org/7799cdd24ca11b15d7a8a85f981da0edd8e1b9bb.jsā. A ServiceWorker passed a promise to FetchEvent.respondWith() that rejected with āError: no-response :: [{"url":"https://sea2.discourse-cdn.com/julialang/highlight-js/discourse.julialang.org/7799cdd24ca11b15d7a8a85f981da0edd8e1b9bb.js"}]ā. workbox-core.prod.js:2:86
13:13:57.974 Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sea2.discourse-cdn.com/julialang/highlight-js/discourse.julialang.org/7799cdd24ca11b15d7a8a85f981da0edd8e1b9bb.js. (Reason: CORS request did not succeed). Status code: (null).
13:13:57.974 Module source URI is not allowed in this document: āhttps://sea2.discourse-cdn.com/julialang/highlight-js/discourse.julialang.org/7799cdd24ca11b15d7a8a85f981da0edd8e1b9bb.jsā. 106674:41:141
Iām not seeing any highlighting either.
Itās this.
Domain discourse.julialang.org sends header strict-origin-when-cross-origin
which blocks the loadƬng of https://sea2.discourse-cdn.com/julialang/highlight-js/discourse.julialang.org/7799cdd24ca11b15d7a8a85f981da0edd8e1b9bb.js
as it is a different domain.
It needs a second header Access-Control-Allow-Origin
configured properly.
Huh. Thanks for raising and identifying this; not sure how or why it regressed. Iāll look into it when I can.
This should now be fixed, thanks to the Discourse hosting team!
julia> struct T; end # works!
Out of curiosity, what sort of highlighting is there supposed to be? My desktop browser (Chrome) shows no highlighting of any kind, and never has. So I at first didnāt even understand what this thread was about.
My phone browser actually does show some very subtle highlighting, bold for keywords (I never noticed it before now, because itās so subtle.) And then, the Julia prompt is actually green, which is the only highlighting I have noticed.
What am I missing? Can someone paste an image of highlighted code for me to see? Is it only for mobile?
This is what you should see on all platforms. Itās not just a mobile thing.
Itās not too dramatic, but keywords are bolded, some builtin types are blue, numbers are teal, strings are red, comments are italicized gray. Do you have any errors in your browser console?
Yes, I seem to have several. Of interest there is
Access to fetch at 'https://sea2.discourse-cdn.com/julialang/highlight-js/discourse.julialang.org/a596e0a7f2acbeff6663f0d54f3c59b18313c645.js' from origin 'https://discourse.julialang.org' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://sea2.discourse-cdn.com' that is not equal to the supplied origin. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Uncaught (in promise) no-response: no-response :: [{"url":"https://sea2.discourse-cdn.com/julialang/highlight-js/discourse.julialang.org/a596e0a7f2acbeff6663f0d54f3c59b18313c645.js"}]
at u._handle (https://global.discourse-cdn.com/julialang/assets/workbox-77b0e3e0dd4773bcd6c7e74f302f7c69/workbox-strategies.prod.js:54:13)
at async u.Rt (https://global.discourse-cdn.com/julialang/assets/workbox-77b0e3e0dd4773bcd6c7e74f302f7c69/workbox-strategies.prod.js:40:10)
That looks like you still have a stale cache ā thatās the very problem we just fixed. Try clearing your caches and refreshing.
I tried doing that just before you posted, and it works
Oh well. Itās just that I never saw any highlighting, so I didnāt even understand what the discussion was about. āThereās supposed to be highlighting? ā
If anyone is interested in some CSSāing, itās all a matter of themeing. Iām always happy to take suggestions on this ā see, e.g., Adding support for `julia-repl` syntax highlighting - #7 by g-gundam.
julia> if a<1.2 || b=="s" && c in Dict(:a=>'f'); 1::Int end
The highlights.js library puts these classes on the above:
<span class="hljs-meta prompt_">julia></span>
<span class="language-julia">
<span class="hljs-keyword">if</span>
a<
<span class="hljs-number">1.2</span>
|| b==
<span class="hljs-string">"s"</span>
&& c
<span class="hljs-keyword">in</span>
<span class="hljs-built_in">Dict</span>
(:a=>
<span class="hljs-string">'f'</span>
);
<span class="hljs-number">1</span>
::
<span class="hljs-built_in">Int</span>
<span class="hljs-keyword">end</span>
</span>
The HTML highlighting is much more colorful as its markup is so standard that it tags pretty much everything, including things that donāt make much sense in Juliaās syntax (e.g., tags, names, attrs, etc).
The highlighting colors are also a function of the color scheme
selected in your Discourse preferences. A dark scheme gave me
only monochrome highlights (bold, normal, grey, dark grey,ā¦).
Changing to a light scheme made the prompt get a color.
Thatās a good point ā and itās also worth noting that while we ostensibly have five themes available for you to pick here, itās mostly the default Light Theme and Dark Theme that have gotten the most care and attention.
Thanks for this tip! I had my theme set to āgracefulā and some, but not all the highlights. the julia>
prompt didnāt show green, for example. I thought I was the odd one out here with weird highlighting. But switching back to light theme fixed it.