question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unwanted reformatting in teasers

See original GitHub issue

With 0.6.11 I’m seeing unwanted formatting in teasers. With the search term fubarBaz:

<span class="sc-em">fubarbaz</span>

This creates two problems for me. First, the original content is markdown and I don’t want HTML inline. Second the original search term was camel-case fubarBaz, but the teaser shows it downcased.

Are either or both of these behaviors configurable? I took a look at https://github.com/fergiemcdowall/search-index/blob/56043708b4b51ce1df120e4ec99125068b13bc8e/lib/search/searcher.js#L408 where the span is rendered. Seems like passing in a function(string) would be a good solution there. But I haven’t yet figured out where the term is lower-cased.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fergiemcdowallcommented, May 5, 2016

Right- but it does at least solve the problem of customisable markup for teasers.

Requirements for teasers are really variable. I wonder if the best way to deal with this is to extract the teaser functionality out of the core and instead concentrate on a customisable query-result pipeline.

0reactions
mblakelecommented, May 4, 2016

Thanks, but I’m afraid this doesn’t fix either problem. Matches are still downcased, which makes results look funny. For example I have a section header “Introduction” but if it’s highlighted in search results it’s “introduction”. The teaserHighlighter function only gets “introduction”: it doesn’t have enough information about what the original text was.

Matching text that overlaps with markup, as described above, is still a problem. I’m still using markdown and fubar: baz is now better — but now matches in backquotes or other balanced markdown are a problem. I don’t see a way to fix this in teaserHighlighter because it doesn’t know that it’s in a backquote context so it can’t make any adjustments.

Besides capitalization and markup context, there are also problems with matches on stemmed words: for example “condition” vs “conditions”. The teaserHighlighter only gets “condition” so it’s highlighted as conditions with a non-bolded “s” at the end.

It might help somewhat if teaserHighlighter received a second argument that gave the raw text. Plurals and other stemming could still be a problem though. In the long run highlighting needs access to the original text, and some idea of what the matching search term was and which text it matched.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Formatting messed up in Marinelli teaser page | Drupal.org
I'm having an issue with the Marinelli theme. I've developed multiple teaser pages as taxonomy catagories. The pages that have less than 10...
Read more >
How to remove unwanted formatting in Word. -
Type ” clear formatting” and this is the result you see. Type Clear. Select @clear formatting or select from the list that pops...
Read more >
Clear all text formatting - Microsoft Support
On the Home tab, in the Font group, click Clear All Formatting. On the Message tab, in the Basic Text group, click Clear...
Read more >
Drupal 7 - Teaser trim ends after first <p> tag. How can I make ...
I have edited the teasers 'manage display' option and set it 400, then edited and saved any old content, but the teaser is...
Read more >
Overview of the Text Editor (WYSIWYG)
Removing Formatting​​ To remove formatting from your page, highlight the text and select the Remove Formatting icon.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found