diff --git a/_includes/no-linenos.html b/_includes/no-linenos.html deleted file mode 100644 index 8500693..0000000 --- a/_includes/no-linenos.html +++ /dev/null @@ -1,10 +0,0 @@ -{% comment %} - Remove the line number of the code snippet. -{% endcomment %} - -{% assign content = include.content %} - -{% if content contains '
' %}
- {% assign content = content | replace: '', '' %}
-{% endif %}
diff --git a/_includes/post-description.html b/_includes/post-description.html
index 6c40036..c00e516 100644
--- a/_includes/post-description.html
+++ b/_includes/post-description.html
@@ -8,8 +8,17 @@
{%- if post.description -%}
{{- post.description -}}
{%- else -%}
- {%- include no-linenos.html content=post.content -%}
- {{- content | markdownify | strip_html -}}
+ {% comment %}
+ Remove the line number of the code snippet.
+ {% endcomment %}
+ {% assign content = post.content %}
+
+ {% if content contains ' ' %}
+ {% assign content = content | replace: '', '' %}
+ {% endif %}
+
+ {{- content | markdownify | strip_html | newline_to_br | replace: '
', ' ' | strip_newlines -}}
{%- endif -%}
{%- endcapture -%}
diff --git a/_includes/search-loader.html b/_includes/search-loader.html
index 7fd065d..5a43fba 100644
--- a/_includes/search-loader.html
+++ b/_includes/search-loader.html
@@ -12,7 +12,7 @@
{tags}
- {snippet}
+ {content}
{% endcapture %}
diff --git a/assets/js/data/search.json b/assets/js/data/search.json
index 2601ed0..32bcff9 100644
--- a/assets/js/data/search.json
+++ b/assets/js/data/search.json
@@ -5,16 +5,16 @@ swcache: true
[
{% for post in site.posts %}
+ {%- capture description -%}
+ {% include post-description.html %}
+ {%- endcapture -%}
{
"title": {{ post.title | jsonify }},
"url": {{ post.url | relative_url | jsonify }},
"categories": {{ post.categories | join: ', ' | jsonify }},
"tags": {{ post.tags | join: ', ' | jsonify }},
"date": "{{ post.date }}",
- {% include no-linenos.html content=post.content %}
- {% assign _content = content | strip_html | strip_newlines %}
- "snippet": {{ _content | truncate: 200 | jsonify }},
- "content": {{ _content | jsonify }}
+ "content": "{{ description }}"
}{% unless forloop.last %},{% endunless %}
{% endfor %}
]