Closed twellspring closed 3 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.
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
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
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.
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.
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.
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.
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.
Is it solved?
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:
But these do not work. Could you help me to disable code block syntax highlighting?