Phlow / feeling-responsive

»Feeling Responsive« is a free flexible theme for Jekyll built on Foundation framework. You can use it for your company site, as a portfolio or as a blog.
http://phlow.github.io/feeling-responsive/
MIT License
900 stars 1.33k forks source link

Disable syntax highlighting #106

Closed twellspring closed 3 years ago

twellspring commented 8 years ago

The syntax highlighting for code blocks is not working well for my syntax ( SaltStack Yaml with Jinja ). I would like to turn off all code block syntax highlighting. From the Jekyll documentation it appears either of the following in _config.yaml would work:

kramdown:
  syntax_highlighter: nil
kramdown:
  enable_coderay: false

But these do not work. Could you help me to disable code block syntax highlighting?

TWiStErRob commented 8 years ago

How do you highlight your code in the documents? Wouldn't it be just easier to don't specify the highlight language/use a language that doesn't highlight (e.g. text)? This would also allow you to later use highlighting when needed, instead of globally disabling it.

twellspring commented 8 years ago

Yes if I can get language support to work I would like that. But having problems there too. Here is what I see when I try Json. Is this the correct way to specify language?

markdown: kramdown
kramdown:
  input: GFM

And then my code looks like this

``` Json
{
  "git_|-xxxxxxx-repo_xxxxxxxxx_|-git@github.com:xxxxxxxx/xxxxxxxx.git_|-latest": 
  {
    "comment": "No revision matching 'hotfix/x.xx.xx' exists in the remote repository",
    "name": "git@github.com:xxxxxxx/xxxxxxx.git",
    "start_time": "20:34:56.757768",
    "result": false,
    "duration": 489.839,
    "__run_num__": 3,
    "changes": {}
  }
}
 ``` `

( ending in my code has 3 backticks ... can not figure out in github markdown on this issue how to get just three to show there)

The above gives this source for the post

<pre><code class="language-Json">{
  "git_|-xxxxxxx-repo_xxxxxxxxx_|-git@github.com:xxxxxxxx/xxxxxxxx.git_|-latest":
  {
    "comment": "No revision matching 'hotfix/x.xx.xx' exists in the remote repository",
    "name": "git@github.com:xxxxxxx/xxxxxxx.git",
    "start_time": "20:34:56.757768",
    "result": false,
    "duration": 489.839,
    "__run_num__": 3,
    "changes": {}
  }
}
</code></pre>

and it displays like this screen shot 2016-08-22 at 10 40 03 am

twellspring commented 8 years ago

Have not found a document indicating the available coderay language codes. http://coderay.rubychan.de/ lists the languages so I am guessing with Json. Also tried upper case

Also tried

``` JSON 
TWiStErRob commented 8 years ago

Language is lowercase and no space between 3-ticks and language. Don't know about coderay, I'm using rouge, because that seemed most compatible and suggested for GH-pages and Jekyll 3, here's the config that gives me closest approximation of GitHub issue-style markdown.

twellspring commented 8 years ago

Thanks, lower case and no space gives me the highlighting. But the background color is not quite right. Here is a screenshot showing the issue. The first code block has ```json the second uses JSON so is invalid.

screen shot 2016-08-29 at 9 58 15 am

The first results in html code:

<pre class="highlight"> == $0
<code>

and the second:

<pre> == $0
<code>

In your theme pre has background_color: #e3f1c7 which is why the second has the full text box color. But in the first pre class="highlight" does not match so there is no background color on the pre object and you see the background color of <code> which is the same color.

I "fixed" this it alwyas show a full block background color by changing _sass/_11_syntax-hilighting.scss

.highlight { 
    - background: #fff; 
    + background: #e3f1c7; 

I am not sure if that is the best solution to include in the theme. I am open to doing a pull request if you can tell me best way to put this into the theme.

TWiStErRob commented 8 years ago

I'm using a modified/older version of the theme, so the rouge config may be incompatible with the stylesheets of the latest Feeling Responsive.

Btw, that code you're highlighting is not JSON, but YAML.

twellspring commented 8 years ago

Yes you are correct. I had put json on all my code blocks at the beginning by mistake. I changed them all about the time I made the above message, but looks like I mistakenly put JSON there instead of YAML.

Phlow commented 8 years ago

Is it solved?