mirror of
https://github.com/thangisme/notes.git
synced 2025-02-21 06:57:46 -05:00
Optimisations
Optimised CSS selectors. Changed markup in `linenos-test` to inhibit line numbers appearing in YAML examples when testing code fences.
This commit is contained in:
parent
029ba12559
commit
8a9a8a345d
@ -83,8 +83,8 @@ figure.highlight {
|
|||||||
border: 0;
|
border: 0;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
|
||||||
tr > td,
|
td,
|
||||||
td > pre {
|
pre {
|
||||||
@include fs-2;
|
@include fs-2;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -13,30 +13,30 @@ produced by Jekyll (4.1.1 or earlier) for line numbers from highlighted code
|
|||||||
To avoid non-conforming HTML and unsatisfactory layout, HTML compression
|
To avoid non-conforming HTML and unsatisfactory layout, HTML compression
|
||||||
can be turned off by using the following configuration option:
|
can be turned off by using the following configuration option:
|
||||||
|
|
||||||
```yaml
|
{% highlight yaml %}
|
||||||
compress_html:
|
compress_html:
|
||||||
ignore:
|
ignore:
|
||||||
envs: all
|
envs: all
|
||||||
```
|
{% endhighlight %}
|
||||||
|
|
||||||
When using Kramdown code fences, line numbers are turned on globally by the
|
When using Kramdown code fences, line numbers are turned on globally by the
|
||||||
following configuration option:
|
following configuration option:
|
||||||
|
|
||||||
```yaml
|
{% highlight yaml %}
|
||||||
kramdown:
|
kramdown:
|
||||||
syntax_highlighter_opts:
|
syntax_highlighter_opts:
|
||||||
block:
|
block:
|
||||||
line_numbers: false
|
line_numbers: false
|
||||||
```
|
{% endhighlight %}
|
||||||
|
|
||||||
Line numbers can then be suppressed locally using Liquid tags (_without_ the
|
Line numbers can then be suppressed locally using Liquid tags (_without_ the
|
||||||
`linenos` option) instead of fences:
|
`linenos` option) instead of fences:
|
||||||
|
|
||||||
```
|
{% highlight yaml %}
|
||||||
{% raw %}{% highlight some_language %}
|
{% raw %}{% highlight some_language %}
|
||||||
Some code
|
Some code
|
||||||
{% endhighlight %}{% endraw %}
|
{% endhighlight %}{% endraw %}
|
||||||
```
|
{% endhighlight %}
|
||||||
|
|
||||||
# Workarounds
|
# Workarounds
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ be replaced by `code` -- but note that `code=code` cannot be removed).
|
|||||||
|
|
||||||
## Code fences
|
## Code fences
|
||||||
|
|
||||||
````
|
{% highlight default %}
|
||||||
{% raw %}{% capture some_var %}
|
{% raw %}{% capture some_var %}
|
||||||
```some_language
|
```some_language
|
||||||
Some code
|
Some code
|
||||||
@ -55,18 +55,18 @@ Some code
|
|||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
{% assign some_var = some_var | markdownify %}
|
{% assign some_var = some_var | markdownify %}
|
||||||
{% include fix_linenos.html code=some_var %}{% endraw %}
|
{% include fix_linenos.html code=some_var %}{% endraw %}
|
||||||
````
|
{% endhighlight %}
|
||||||
|
|
||||||
## Liquid highlighting
|
## Liquid highlighting
|
||||||
|
|
||||||
```
|
{% highlight default %}
|
||||||
{% raw %}{% capture some_var %}
|
{% raw %}{% capture some_var %}
|
||||||
{% highlight some_language linenos %}
|
{% highlight some_language linenos %}
|
||||||
Some code
|
Some code
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
{% include fix_linenos.html code=some_var %}{% endraw %}
|
{% include fix_linenos.html code=some_var %}{% endraw %}
|
||||||
```
|
{% endhighlight %}
|
||||||
|
|
||||||
_Credit:_ The original version of the above workaround was suggested by
|
_Credit:_ The original version of the above workaround was suggested by
|
||||||
Dmitry Hrabrov at
|
Dmitry Hrabrov at
|
||||||
|
Loading…
x
Reference in New Issue
Block a user