Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search preview shows Markdown source #191

Closed
jtebert opened this issue Aug 16, 2019 · 4 comments
Closed

Search preview shows Markdown source #191

jtebert opened this issue Aug 16, 2019 · 4 comments
Labels

Comments

@jtebert
Copy link

jtebert commented Aug 16, 2019

Describe the bug
When a search term is found in formatted Markdown text (e.g., a link) the search preview shows the raw Markdown rather than text. This is particularly odd-looking when it includes things like liquid template tags.

To Reproduce
Steps to reproduce the behavior:

  1. Create a link on a Markdown page with some searchable text as the link text.
  2. Enter this term in the search bar and look at the preview.

Expected behavior
Text should be shown with the tags/formatting stripped (or at least that's how it currently seems to be doing it on this project's documentation).

Screenshots
search-preview-bug

Desktop (please complete the following information):

  • OS: Ubuntu 18.04
  • Browser: Chrome 76

Additional notes:
This does not occur on this project's documentation. (Try searching for "quick start guide" as an example). My guess is that the bug comes from the way that the search JSON is being compiled. Updating with bundle update didn't solve the problem.

@jtebert jtebert added the bug label Aug 16, 2019
@pmarsceill
Copy link
Collaborator

@jtebert can you paste the contents of your site's search-data.json file?

@SgtSilvio
Copy link
Contributor

The problem is, that jekyll processes all files in alphabetical order. So search.json is processed before zsh.md and the content is therefore not yet rendered while including it in the json file.
The markdownify filter only processes markdown but not liquid.

The only solution seems to be to rename the search-data.json file to zzzz-search-data.json and add a permalink: /assets/js/search-data.json

@jtebert
Copy link
Author

jtebert commented Jan 21, 2020

I'd forgotten about this issue, but it seems to have been resolved by some update since I created it, so I'm going to close the issue.

@jtebert jtebert closed this as completed Jan 21, 2020
thisconnect pushed a commit to digitalbitbox/user-guides that referenced this issue Jan 18, 2021
The preview in search results dropdown showed sometimes jekyll
includes when it should display text snippets of the results.

The problem is when search-data.json is rendered every file after
S has not been rendered yet as jekyll processes all files in
alphabetical order. In that case the search might display jekyll
includes or raw markdown.

Renaming search-data.json to zzzz-search-data with a permalink
fixes this, see upstream fix. Also removed .json as the file
is a template that will render to JSON.

just-the-docs#191 (comment)
thisconnect pushed a commit to digitalbitbox/user-guides that referenced this issue Jan 18, 2021
The preview in search results dropdown showed sometimes jekyll
includes when it should display text snippets of the results.

The problem is when search-data.json is rendered every file after
S has not been rendered yet as jekyll processes all files in
alphabetical order. In that case the search might display jekyll
includes or raw markdown.

Renaming search-data.json to zzzz-search-data with a permalink
fixes this, see upstream fix. Also removed .json as the file
is a template that will render to JSON.

just-the-docs#191 (comment)
@jcapogna
Copy link

jcapogna commented Jun 27, 2021

I'm having this problem in the latest version (0.3.3).

I'm seeing Markdown for images and links showing up in previews.

Here is a minimal Markdown example to reproduce:

This is the index page

[Link](http://link.com)

uniquekeyword

Searching for uniquekeyword results in the following preview:

Screen Shot 2021-06-27 at 6 31 12 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants