Skip to content

Commit

Permalink
Add missing class without language- prefix
Browse files Browse the repository at this point in the history
```html
<figure class="language-js ..." ...>
````

must become

```html
<figure class="language-js js ..." ...>
```

In addition fix padding to get the same pixel alignment for gutter and sourcecode
  • Loading branch information
kakawait committed Jul 14, 2019
1 parent 77b21c7 commit df84e1a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/helpers/jquery.fancybox-thumbs.min.css" integrity="sha256-SEa4XYAHihTcEP1f5gARTB2K26Uk8PsndQYHQC1f4jU=" crossorigin="anonymous" />
<!--EXTERNAL STYLES END-->
<!--STYLES-->
<link rel="stylesheet" href="/css/style-twzjdbqhmnnacqs0pwwdzcdbt8yhv8giawvjqjmyfoqnvazl0dalmnhdkvp7.min.css" />
<link rel="stylesheet" href="/css/style-wik7mbcbqrkh23wgvlthjshwgzac8yaqzlrnqy5qqytc9midmzj3trvo2.min.css" />
<!--STYLES END-->
{{ range .Site.Params.customCSS }}
{{ if isset . "href" }}
Expand Down
6 changes: 3 additions & 3 deletions layouts/shortcodes/codeblock.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{{ end }}
{{ end }}
{{ $trimmedContent := trim .Inner "\n" }}
<figure class="highlight {{ $.Scratch.Get "c-language" }} language-{{ with ($.Scratch.Get "c-language") }}{{ . }}{{ end }}">
<figure class="highlight {{ $.Scratch.Get "c-language" }} language-{{ $.Scratch.Get "c-language" }}">
<figcaption>
{{ if and (($.Scratch.Get "c-url") ($.Scratch.Get "c-title")) }}
<span>{{ $.Scratch.Get "c-title" }}</span><a href="{{ ($.Scratch.Get "c-url") | safeURL }}" target="_blank" rel="external">{{ $.Scratch.Get "c-link-text" | default ($.Scratch.Get "c-title") }}</a>
Expand All @@ -33,9 +33,9 @@
<pre>{{ range $index,$value := (split $trimmedContent "\n") }}<span class="line">{{ add $index 1 }}</span><br>{{ end }}</pre>
</td>
<td class="code">
<pre class="code-highlight language-{{ $.Scratch.Get "c-language" }}"><code class="{{ $.Scratch.Get "c-language" }}">{{ $trimmedContent }}</code></pre>
<pre class="code-highlight language-{{ $.Scratch.Get "c-language" }} {{ $.Scratch.Get "c-language" }}"><code class="{{ $.Scratch.Get "c-language" }}">{{ $trimmedContent }}</code></pre>
</td>
</tr>
</tbody>
</table>
</figure>
</figure>
8 changes: 4 additions & 4 deletions layouts/shortcodes/tabbed-codeblock.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@
<li class="tab {{ if eq $index 0 }}active{{ end }}">{{ . }}</li>
{{ end }}
</ul>
</figcaption>
</figcaption>
<div class="tabs-content">
{{ range $index, $value := $.Scratch.Get "tc-content" }}
{{ $trimmedContent := trim $value "\n" }}
<figure class="highlight language-{{ index ($.Scratch.Get "tc-languages") $index }}" style="display: {{ if eq $index 0 }}block{{ else }}none{{ end }};">
<figure class="highlight language-{{ index ($.Scratch.Get "tc-languages") $index }} {{ index ($.Scratch.Get "tc-languages") $index }}" style="display: {{ if eq $index 0 }}block{{ else }}none{{ end }};">
<table>
<tbody>
<tr>
<td class="gutter">
<pre>{{ range $index,$value := (split $trimmedContent "\n") }}<span>{{ add $index 1 }}</span><br>{{ end }}</pre>
</td>
<td class="code">
<pre class="code-highlight language-{{ index ($.Scratch.Get "tc-languages") $index }}"><code class="{{ index ($.Scratch.Get "tc-languages") $index }}">{{ $trimmedContent }}</code></pre>
<pre class="code-highlight language-{{ index ($.Scratch.Get "tc-languages") $index }} {{ index ($.Scratch.Get "tc-languages") $index }}"><code class="{{ index ($.Scratch.Get "tc-languages") $index }}">{{ $trimmedContent }}</code></pre>
</td>
</tr>
</tbody>
</table>
</figure>
{{ end }}
</div>
</figure>
</figure>
6 changes: 3 additions & 3 deletions src/scss/components/_code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ figure.highlight,
// Gutter which contains line numbers
.gutter {
border-right: map-get($highlight, border);
padding: 0.3em 15px;
padding: 0.3rem 15px;
line-height: map-get($highlight, line-height);
font-size: map-get($highlight, font-size);

Expand All @@ -60,7 +60,7 @@ figure.highlight,
}
// Code container
.code {
padding: 0.3em 15px 0.3em 1em;
padding: 0.3rem 15px 0.3rem 1em;
width: 100%;

pre {
Expand Down Expand Up @@ -112,4 +112,4 @@ figure.highlight,
font-size: 1em;
margin: 0 0 5px 0;
}
}
}

Large diffs are not rendered by default.

0 comments on commit df84e1a

Please sign in to comment.