Pygment breaks if code context is not recognized #1375

Closed
mnemnion opened this Issue Aug 4, 2013 · 10 comments

Comments

Projects
None yet
4 participants

mnemnion commented Aug 4, 2013

Hi,

I'm filing this is a Jekyll issue because it doesn't appear to be Octopress, and because while the poor behavior is Pygments, Jekyll is calling it when it happens.

PS: the auto-markdown is making this hard to read. Please consult the actual raw text. Thanks

taking a simple file like this:


---
layout: post
title: "tosser"
date: 2013-08-04 10:03
comments: true
published: false
categories: 
--- 

` ` `clojure
(def howdy "Hi Jekyll!")
` ` `

Of course works fine. If you change the code block to this:

` ` `clojureexperiment
(def howdy "this silently breaks!")
` ` `

Jekyll chokes. When using rake preview, rake must be quit and restarted before it works again.

I believe the correct behavior would be to use default syntax highlighting if the code name isn't recognized.

Member

penibelst commented May 13, 2014

Jekyll now supports the Rouge highlighter. Try it.

Owner

parkr commented May 13, 2014

Jekyll now supports the Rouge highlighter. Try it.

Octopress doesn't support Jekyll 2.0, or Jekyll 1.0 for that matter so it looks like @mnemnion won't be able to use your solution.

So @mnemnion you're saying that when you specify a language that doesn't exist in the Pygments codebase, it throws an error? Can you please paste the output of your command?

Owner

parkr commented Jul 31, 2014

No response.

parkr closed this Jul 31, 2014

mnemnion commented Aug 1, 2014

Example of breaking input:

this.is.fooCode();

That's all it takes. I'm disinclined to crash octopress into a wall to
reproduce the error, but that was the issue.

On Tue, May 13, 2014 at 8:28 AM, Parker Moore notifications@github.com
wrote:

Jekyll now supports the Rouge highlighter. Try it.

Octopress doesn't support Jekyll 2.0, or Jekyll 1.0 for that matter so it
looks like @mnemnion https://github.com/mnemnion won't be able to use
your solution.

So @mnemnion https://github.com/mnemnion you're saying that when you
specify a language that doesn't exist in the Pygments codebase, it throws
an error? Can you please paste the output of your command?


Reply to this email directly or view it on GitHub
#1375 (comment).

Owner

parkr commented Aug 1, 2014

Do you get a lang not recognized error?

mnemnion commented Aug 1, 2014

Running "rake generate" from octopress, the breaking input generates the
following errors:

Generating Site with Jekyll

identical source/stylesheets/screen.css

Configuration from /Users/atman/Dropbox/Projects/code/octopress/_config.yml

/Users/atman/Dropbox/Projects/code/octopress/plugins/redcarpet2_markdown.rb:6:
warning: already initialized constant PYGMENTS_CACHE_DIR

Building site: source -> public

/Users/atman/Dropbox/Projects/code/octopress/plugins/pygments_code.rb:27:in
`rescue in pygments': Pygments can't parse unknown language: foo.
(RuntimeError)

from
/Users/atman/Dropbox/Projects/code/octopress/plugins/pygments_code.rb:24:in
`pygments'

from
/Users/atman/Dropbox/Projects/code/octopress/plugins/pygments_code.rb:14:in
`highlight'

from
/Users/atman/Dropbox/Projects/code/octopress/plugins/backtick_code_block.rb:37:in
`block in render_code_block'

from
/Users/atman/Dropbox/Projects/code/octopress/plugins/backtick_code_block.rb:13:in
`gsub'

from
/Users/atman/Dropbox/Projects/code/octopress/plugins/backtick_code_block.rb:13:in
`render_code_block'

from
/Users/atman/Dropbox/Projects/code/octopress/plugins/octopress_filters.rb:12:in
`pre_filter'

from
/Users/atman/Dropbox/Projects/code/octopress/plugins/octopress_filters.rb:28:in
`pre_render'

from
/Users/atman/Dropbox/Projects/code/octopress/plugins/post_filters.rb:112:in
`block in pre_render'

from
/Users/atman/Dropbox/Projects/code/octopress/plugins/post_filters.rb:111:in
`each'

from
/Users/atman/Dropbox/Projects/code/octopress/plugins/post_filters.rb:111:in
`pre_render'

from
/Users/atman/Dropbox/Projects/code/octopress/plugins/post_filters.rb:166:in
`do_layout'

from
/Users/atman/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/post.rb:195:in
`render'

from
/Users/atman/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:200:in
`block in render'

from
/Users/atman/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:199:in
`each'

from
/Users/atman/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:199:in
`render'

from
/Users/atman/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:41:in
`process'

from
/Users/atman/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/bin/jekyll:264:in
`<top (required)>'

from /Users/atman/.rbenv/versions/1.9.3-p0/bin/jekyll:23:in `load'

from /Users/atman/.rbenv/versions/1.9.3-p0/bin/jekyll:23:in `

'

On Fri, Aug 1, 2014 at 11:33 AM, Parker Moore notifications@github.com
wrote:

Do you get a lang not recognized error?


Reply to this email directly or view it on GitHub
#1375 (comment).

Owner

parkr commented Aug 1, 2014

That's not a problem with Jekyll, it's a problem with Octopress. The stacktrace isn't in our codebase:

/Users/atman/Dropbox/Projects/code/octopress/plugins/pygments_code.rb:27:in `rescue in pygments': Pygments can't parse unknown language: foo. (RuntimeError)

mnemnion commented Aug 1, 2014

thanks, I'll open an issue there.

On Fri, Aug 1, 2014 at 12:11 PM, Parker Moore notifications@github.com
wrote:

That's not a problem with Jekyll, it's a problem with Octopress. The
stacktrace isn't in our codebase:

/Users/atman/Dropbox/Projects/code/octopress/plugins/pygments_code.rb:27:in `rescue in pygments': Pygments can't parse unknown language: foo. (RuntimeError)


Reply to this email directly or view it on GitHub
#1375 (comment).

Owner

parkr commented Aug 1, 2014

What would you rather have it do? It should fail in my opinion – only valid languages should be allowed. Failing loudly just means you'll catch this error instead of it just messing up your site.

mnemnion commented Aug 1, 2014

I would prefer it default to 'text' highlighting, namely nothing. New and
obscure languages show up all the time, and if it defaults without error,
updates could provide highlighting. Let's say I wanted some 'swift' code;
there will be a highlighter eventually, and I should be able to tag code
with the correct name.

On Fri, Aug 1, 2014 at 12:44 PM, Parker Moore notifications@github.com
wrote:

What would you rather have it do? It should fail in my opinion – only
valid languages should be allowed. Failing loudly just means you'll catch
this error instead of it just messing up your site.


Reply to this email directly or view it on GitHub
#1375 (comment).

jekyllbot locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.