Closed vpereira closed 7 years ago
The JavaScript scanner is not different from any other scanner, and the div encoder should produce valid HTML. Can you give me more details? Check what CodeRay returns. Also, try line_numbers: :table
.
Hi, line_numbers as table didn't help.
HTML rendered java code: https://gist.github.com/vpereira/aa1ed682d57434d12ce97fd892c8b480
HTML rendered javascript code: https://gist.github.com/vpereira/32edd3e4aaffe9ee07f59d5e49c7b757
So I'm rendering both using the function as I sent, but the java (and all other languages.. i render php, sh, rb, etc) code renders the whole layout and somehow rendering javascript ignores the layout, as if the rendered js was interfering
hm, it look like rails is understanding it as JS, because of the file extension.. hmpf
Started GET "/codestreams/Factory/packages/spacewalk/package_files/%2Fhome%2Fvpereira%2Fspacewalk%2Fprojects%2Fpython-gzipstream%2Fhtml%2Fepydoc.js" for 127.0.0.1 at 2017-01-09 10:01:19 +0100 Processing by PackageFilesController#show as JS
So it seems this is not a CodeRay bug. Can I close it?
yes, sorry about the noise. Coderay rules!
Hi,
I'm using CodeRay to render different code bases and I noted that some how rendering javascript interfers with my layout. I'm callying CodeRay in my view like:
<%= raw CodeRay.scan(c,t).div(:line_numbers => :inline, :wrap=>:div) %>
where c is the code and t the results of
CodeRay::FileType.fetch(filepath_text, :text)
I was not sure if it was happening some code execution, since I'm calling raw and therefore I'm not escaping the output from CodeRay.. but an alert box didn't pop-up when I tried it :)
Anyway, my rendered code looks like:
python, java, c, etc code being rendered:
javascript being rendered:
I'm using coderay 1.1.1
thanks!