Skip to content
Discussion options

You must be logged in to vote

so I was able to semi-figure it out through a hacky way using the custom overrides feature of mkdocs to remove the leading - if present before submitting the query to lunr. This has a drawback of now removing the "exclude" feature that leading - are supposed to have...but for our use case I think this solution might work.

here is what i added to our overrides/main.html:

{% block config %}
  {{ super() }}
  <script>
    var __search = {
      transform: function(query) {
        return query
          .split(/"([^"]+)"/g) 
            .map((terms, index) => index & 1
              ? terms.replace(/^\b|^(?![^\x00-\x7F]|$)|\s+/g, " +")
              : terms
            )
            .join("")

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@squidfunk
Comment options

@flynneva
Comment options

Answer selected by flynneva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants