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
doc: extensions: add kconfig search extension #41753
Conversation
can we just list them somewhere without any individual rst pages for search engines to index with instructions to use the search capability for more details? |
Maybe by rendering the whole database will help if crawler is detected: https://developers.google.com/search/docs/advanced/javascript/dynamic-rendering |
4d251d4
to
7a3fefa
Compare
that kind of sounds like an |
It's a cool idea and I played around with it a bit on your demo site. It is indeed fast, which is great. I don't think having a complete list of Kconfig options in our rendered HTML is very useful except for crawlers, so I think that's not a big loss. One thing I noticed so far is that you chose to narrow down the set of locations from the complete list of locations in the current pages to just one location. This is picking bad results. For example, look at CONFIG_SPI_2_NRF_SPIM: https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_SPI_2_NRF_SPIM.html The search results page is picking the "wrong" location for it: |
Seems to be a bug in the database generation. It's incomplete now, I need to figure out a way to store all the locations and present the information in a better way to avoid things like that: |
912f914
to
163d3e6
Compare
+1 assuming the issue I pointed out is fixed |
Would it be possible to add some html param that would allow to capture search list? This would be useful in case when you need to inform somebody on list of Kconfig options that are dedicated to specific subsystem, for example: |
163d3e6
to
adab900
Compare
adab900
to
0e7dac7
Compare
444fdb9
to
e8b599c
Compare
Add a new extension to handle Kconfig documentation. This means that no more CMake hackery is required. However, the way it works differs from the current approach. Instead of creating a single page for each Kconfig option, the extension creates a JSON "database" which is then used on the client side to render Kconfig options on a search page. The reason to go for a single page choice is because Sphinx is significantly slow when handling a lot of pages. Kconfig was responsible for an increase of about ~10K pages. Main features: - Generates a Kconfig JSON database using kconfiglib APIs. - Adds a new Sphinx domain for Kconfig. The domain provides a directive, :kconfig:search:: that can be used to insert a Kconfig search box onto any page. This page is where all Kconfig references inserted using the :kconfig:option: role will point to. The search functionality is implemented on the client side using Javascript. If the URL contains a hash with a Kconfig option (e.g. #CONFIG_SPI) it will load it. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Enable the new extension and delete usage of the old script/extensions. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Kconfig options now belong to the Kconfig domain, therefore, the :kconfig:option: role needs to be used. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
These are no longer used. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
@mbolivar-nordic @henrikbrixandersen @carlescufi @nashif should be ready now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation changes (and the entire concept) looks fine. Thanks!
I know too little of Sphinx to feel comfortable in reviewing the actual Kconfig extension, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm giving a +1 for the feature without having reviewed in detail because I'm confident @gmarull will fix any issues that might get reported after this is merged. Thanks for this.
@gmarull IIUC, zephyr/scripts/kconfig/kconfig.py Lines 200 to 205 in f17630b
|
Kconfig generated documentation links changed with zephyrproject-rtos/zephyr#41753, this fixes all the upstream links in the existing documentation. BRANCH=none BUG=none TEST=check link on gerrit Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ib619924837ace0a482d7977fb2676456e2fc6858 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3500306 Reviewed-by: Aaron Massey <aaronmassey@google.com>
Introduction
This PR adds a new Sphinx extension to handle Kconfig documentation. The way this extension works differs significantly from the current approach, mainly due to technical limitations that will be detailed next. As of today, a bunch of RST pages are generated (one per option, so ~10K) by a script (
gen_kconfig_rest.py
). These pages get parsed and rendered by Sphinx when the documentation is built. It turns out that adding ~10K individual pages to Sphinx slows things down, to a point we had to create theKCONFIG_TURBO_MODE
orhtml-fast
targets. In practice, this means that any viable solution needs to stay away from individual pages. In fact, the way bindings docs work suffer from the same issue, just that we still have less of them.Technical aspects of the solution proposed here:
kconfiglib
to build a JSON database for all Kconfig symbols.. kconfig:search::
) that can be used to insert a Kconfig search tool on any RST page. When building HTML docs, that directive gets replaced by an actual search form. The:kconfig:option:
role is now available to reference options (goes to Kconfig search form pre-selecting the option). Thanks to using a regular Sphinx domain, Kconfig options can also be referenced in other projects using Intersphinx.#KCONFIG_OPTION_TO_DISPLAY
it will just display it. This allows for permalinks, e.g., CONFIG_SPI.Pros:
Cons:
Demo
https://teslabs.github.io/zephyr-kconfig-test/kconfig.html