-
After doing some digging on why search queries that start with a hyphen (see the I noticed that on the mkdocs site querying for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
so I was able to semi-figure it out through a hacky way using the custom overrides feature of mkdocs to remove the leading here is what i added to our {% 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("")
.replace(/"|(^\-+)|(?:^|\s+)[*+:^~]+(?=\s+|$)/g, "")
.trim()
}
}
</script>
{% endblock %} |
Beta Was this translation helpful? Give feedback.
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
: