elotroalex / ed

A jekyll theme for minimal editions
Other
125 stars 132 forks source link

Added highlight for search feature #30

Closed ajleon95 closed 8 years ago

ajleon95 commented 8 years ago
  1. The container div for the content now has id main to simplify the JavaScript.
  2. The search page now appends GET parameter q to each result link to allow for highlighting.
  3. The search form no longer submits upon hitting enter to prevent the user from accidentally losing their query and results.
  4. A small JavaScript script gets the parameter q, processes the result, and adds the tag <mark> around any matches.
  5. color property on mark was set to inherit to match the rest of Ed's theme (defaults to black).

As of right now the script will not highlight a term that is split by a footnote (e.g. searching "bugle trills" will return "O Captain! My Captain!" but will not be highlighted), but will work within footnotes.

ajleon95 commented 8 years ago

Embarrassingly, there are some cases where the variable names collide. I will re-create this pull request with new changes.