Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax Highlighting crashing rendering on bad language name #112

Closed
jhwarehouse opened this issue Oct 9, 2013 · 4 comments
Closed

Syntax Highlighting crashing rendering on bad language name #112

jhwarehouse opened this issue Oct 9, 2013 · 4 comments
Milestone

Comments

@jhwarehouse
Copy link

Hi Adam,

Sorry to bug you again. I noticed that on the new release the syntax highlighting seems to be broken. If I try to specify SQL for syntax highlighting the markdown-here toggle has not effect.

This is what I used to do but doesn't work anymore:

select * from test

The code block syntax without the "SQL" part does work though.

image

@adam-p
Copy link
Owner

adam-p commented Oct 9, 2013

There's certainly something wrong with that I'll investigate further.

But for right now, try using "sql" instead of "SQL". I believe that it will work.

@jhwarehouse
Copy link
Author

Hi Adam,

That did it. Using a lower case sql worked great. As always, thanks for
the amazing support.

Thanks,
Chris

On Wed, Oct 9, 2013 at 11:46 AM, Adam Pritchard [email protected]:

There's certainly something wrong with that I'll investigate further.

But for right now, try using "sql" instead of "SQL". I believe that it
will work.


Reply to this email directly or view it on GitHubhttps://github.com//issues/112#issuecomment-25997394
.

@adam-p
Copy link
Owner

adam-p commented Oct 9, 2013

I changed the title of this bug. It's still bad (and a regression) that rendering is breaking completely when the language name is "wrong" (i.e., doesn't match what Highlight.js expects). I'll fix this soon.

You're on a roll. Find more bugs.

@adam-p
Copy link
Owner

adam-p commented Oct 10, 2013

Fixed in rev 21a2231. Will be in next release.

Here's how it will behave now:

  • If you use a valid language name you're fine.
  • If you use the wrong case of a valid language name (like "SQL" vs. "sql"), the lowercase form will also be checked and the highlighting will work.
    • Caveat: the code element class will look like <pre><code class="language-SQL">... vs. <pre><code class="language-sql">.... If this is a problem in the future we can change it by modifying Marked.js.
  • If you use an invalid language name, it will be rendered to a non-syntax-highlighted code block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants