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 returning entire page in search box [mkdocs-material insiders] #3053
Comments
Thanks for the reporting. That looks off indeed. It's weird that it only happens when run from GitHub Actions. Could you please include the Markdown of the page and upload the contents of the |
The project in question is here, correct? |
Okay, here's what I think is happening: I took a look at your repository and realized that the Expand{
"config":{
"indexing":"full",
"lang":[
"en"
],
"min_search_length":3,
"prebuild_index":false,
"separator":"[\\s\\-]+"
},
"docs":[
{
"location":"",
"text":"Welcome to LA Metro Digital Design System Docs \u00b6 This repository is an internal resource for the Digital Services Team at Metro. Documentation either does not exist, is outdated, exists on old platforms, or exists across multiple platforms used by different people. There is a need to centralize and keep documentation up-to-date for the entire team to use and reference. Do not put any account credentials or private keys here. Contributing \u00b6 To provide more information on the various Digital Design Projects at LA Metro, people can contribute to this documentation by following these steps: Pre-requisites \u00b6 Software \u00b6 Make sure you have the following installed: - GitSVN - VS Code (or other text based editor) Accounts \u00b6 -GitHub.com account Clone the Repository \u00b6 Open your editor and run in the terminal: git clone https://github.com/albertkun/digital-design-system-docs.git Categories \u00b6 Web Properties Tools/Services (through P-Card or ITS) Processes Shakeup updates Questions \u00b6 Feel free to reach out if you have any questions!",
"title":"Welcome to LA Metro Digital Design System Docs"
},
{
"location":"#welcome-to-la-metro-digital-design-system-docs",
"text":"This repository is an internal resource for the Digital Services Team at Metro. Documentation either does not exist, is outdated, exists on old platforms, or exists across multiple platforms used by different people. There is a need to centralize and keep documentation up-to-date for the entire team to use and reference. Do not put any account credentials or private keys here.",
"title":"Welcome to LA Metro Digital Design System Docs"
},
{
"location":"#contributing",
"text":"To provide more information on the various Digital Design Projects at LA Metro, people can contribute to this documentation by following these steps:",
"title":"Contributing"
},
{
"location":"#pre-requisites",
"text":"",
"title":"Pre-requisites"
},
{
"location":"#clone-the-repository",
"text":"Open your editor and run in the terminal: git clone https://github.com/albertkun/digital-design-system-docs.git",
"title":"Clone the Repository"
},
{
"location":"#categories",
"text":"Web Properties Tools/Services (through P-Card or ITS) Processes Shakeup updates",
"title":"Categories"
},
{
"location":"#questions",
"text":"Feel free to reach out if you have any questions!",
"title":"Questions"
}
]
} This is also (a subset?) of what you've posted in the screenshot – the main entry lists all contents including headlines and permalink markers. My guess is that when you've visited the page, somehow a stale version of the I would kindly ask you to verify two things:
On a side note: a few days ago, somebody also reported this on Gitter, but the problem seems to have just gone away because I didn't hear back from him, which also sounds like a caching problem that has solved itself. |
yes, that is correct! |
the In addition to the link: Regarding deploying to another domain, how should I approach this using GitHub pages? Should I just clone into a new repository? Thank you for taking the time to look into this!! |
Thanks for investigating. Yes, that looks broken indeed. If you compare it to the As the I'm closing this issue since this is not an error that is related to Material for MkDocs, but to a deployment misconfiguration.
You could fork the repository and deploy it again, yes. |
@squidfunk hmm, working on this a little more... I'm still unable to resolve this, even by forking or using the default github actions... I was able to resolve this by running However, this solution is not ideal since we would like to run github actions to build it.. Here's the current github actions
https://github.com/LACMTA/digital-services-team-docs/blob/dev/.github/workflows/main.yml Any other insights would be appreciated!! Thank you! |
Okay, so I can finally reproduce this issue and think I've found the cause of the problem. Insight and observations
WorkaroundAs a temporary workaround, this installation method seems to work reliably:
MitigationsThe best idea I could think of would be to patch this function in MkDocs to effectively allow for overriding the search plugin. Personally, I believe this is a sound case. After all, the MkDocs team always advertised that the built-in search plugin is only meant for demonstration purposes, and they've always encouraged users to provide alternate implementations. Here we have an alternate implementation that is superior in many ways. The necessary patch would be: def get_plugins():
""" Return a dict of all installed Plugins as {name: EntryPoint}. """
plugins = importlib_metadata.entry_points(group='mkdocs.plugins')
pluginmap = {}
for plugin in plugins:
if plugin.name in pluginmap and "mkdocs.contrib" in plugin.value:
continue
pluginmap[plugin.name] = plugin
return pluginmap @oprypin, @facelessuser, @ultrabug – looping you in for a constructive discussion on this topic. If there's any other possibility without patching core I'm happy to discuss. Nonetheless, I'd expect the proposed patch to not break anything, and to be sound in terms of community-contributed plugins. |
@squidfunk Thank you so much for looking into this so detailed and providing a work around/solution! I can confirm that this workaround works! ✔️
I'll continue to monitor this thread to see if/when the patch becomes available! |
@squidfunk I don't see any immediate concerns with your approach. It seems that allows overrides of mkdocs plugins specifically, which seems okay. If mkdocs plugins come first, they'll be overridden by user plugins, and if user plugins come first, they will take priority over mkdocs plugins. I don't see anything wrong with it. I've seen it mentioned that if people don't like the search they can write their own plugin, is there really no way to have a search plugin identified the same way in templates unless they override the MkDocs search? If so, then I think this is a fine workaround. If not, then I'd love to hear how it can be done. I always assumed that if you wrote your own search, it would work as a drop-in replacement, if that isn't how it works, then it seems a reasonable request to MkDocs to make it so. |
@facelessuser thanks for your take on this!
The
I will open a PR for this, which can be used as a further basis for discussion. I really hope for this to make its way into |
I've opened a pull request in mkdocs/mkdocs#2591 with the necessary changes. I've also updated the OP to list the workaround to new users experiencing this issue. |
This suggested change to MkDocs makes sense to me and will be approved. I still have to comment that I don't like that what you're developing totally bypasses upstream. Your expertise could've been so useful, but instead we're gathered here to solve an issue that exists just because this is not upstreamed. I mean, how can you brag that it's so much better when you never offered any of that to upstream and it's paywalled. Anyway, I'll also admit it's not as simple as I make it sound, there are arguments to your decision, even good technical arguments, but yeah... |
@oprypin thanks for your review of mkdocs/mkdocs#2591!
I understand that it looks like it makes sense to upstream it. Let me explain why I believe that at this point in time, it doesn't:
Now, regarding the "bragging": It was not my intention to brag. If that's what you get from the blog article, I'd be curious to learn what exactly you read as bragging, because I tried to make it as scientific and data-driven as possible. I also explained the rationale behind the changes, diving into the details on how search is currently working, and how I believe it could be improved. My intention was to show the huge potential that lies in rethinking this topic. If you wish to give constructive criticism, ping me at martin.donath@squidfunk.com (or on Gitter), as I don't want to hijack this thread for something offtopic. Also, I get it: you don't like what I'm doing with Insiders. We've had a previous discussion on this regarding your section index plugin. But please, understand: I'm not forcing anybody to use Insiders. It's entirely optional. Even without Insiders, this theme is probably the most feature-rich in the MkDocs ecosystem and there's nothing that forces users into Insiders. Everything is either an improved drop-in replacement or behind a feature flag. Additionally, I'm doing the best I can to triage issues quickly, answer discussions, etc. I'm doing many bug fixes (check the commit history and last releases) on this repository and add new features (hello new content tabs!) which I don't put into Insiders, behind a – as you say – "paywall". Please take a look at the list of features that were only possible to develop with the financial support of my sponsors, because otherwise, I wouldn't have the time. Also, you're using at least some previously exclusive features on your documentation projects, so you're actually benefiting from it. Again, if you feel there's something to be discussed, please ping me (email above). I'm happy to discuss any concerns. |
Thanks for the detailed response. Indeed these are solid arguments. |
@albertkun |
I just released 7.3.3-insiders-3.1.3, bumping the minimum MkDocs version to 1.2.3 which contains the fix. Updating to this version resolves this issue, which means it can be closed. Thanks to all of you for helping to work towards a solution! |
Thanks for reporting. In order to look into it, I'm going to need a reproduction, i.e. the Markdown that makes up the page that is being returned in its entirety (like you're saying). I don't need the content – you can replace it with bogus. If you manage to create a reproduction, please open a new issue. |
Contribution guidelines
I've found a bug and checked that ...
mkdocs
orreadthedocs
themescustom_dir
,extra_javascript
andextra_css
Description
Using
mkdocs-material insiders
search function seems to be returning the entire pages content alongside the paragraph symbol in the search results. This only occurs using deployment on GitHub pages, not locally.Expected behaviour
I expect the search function to work the same on deployment as it does locally and not display the entire content of the page in the search tool, as follows:
Actual behaviour
The insiders version of mkdocs-material makes the search result return all of the page in its entirety.
Steps to reproduce
tags
to pages usingmkdocs-material insiders
Package versions
Python 3.9.5
mkdocs, version 1.2.2
7.2.8+insiders.3.0.1
Configuration
System information
The text was updated successfully, but these errors were encountered: