Skip to content

Commit 1a87c4f

Browse files
🚀 Adds no-linenos include to remove line number indicators from highlighted code blocks
1 parent fba8833 commit 1a87c4f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

‎_includes/no-linenos.html‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{% comment %}
2+
This include removes line number indicators from highlighted code blocks.
3+
Used to clean up code content for display in post previews.
4+
{% endcomment %}
5+
6+
{%- capture content -%}
7+
{%- if include.content -%}
8+
{{- include.content -}}
9+
{%- endif -%}
10+
{%- endcapture -%}
11+
12+
{{- content | remove: '<div class="nolineno"' | remove: '</div>' -}}

‎_layouts/home.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ <h1 class="card-title my-2 mt-md-0">{{ post.title }}</h1>
6969

7070
<div class="card-text content mt-0 mb-3">
7171
<p>
72-
{% include no-linenos.html content=post.content %} {{ content |
73-
markdownify | strip_html | truncate: 200 | escape }}
72+
{{ post.content | markdownify | strip_html | truncate: 200 |
73+
escape }}
7474
</p>
7575
</div>
7676

0 commit comments

Comments
 (0)