Is it possible to use native MkDocs themes in the RTD builds? If not, it would be a valuable addition.
Here is what I'm trying to achieve. I'm trying to setup RTD build for a GitHub project that uses mkdocs: https://readthedocs.org/projects/devtools-course-practice-mkdocs/. This is just an experiment, but it seems that the current level of mkdocs support by RTD is very limited (making it almost useless):
theme: mkdocs in my mkdocs.yml, but it doesn't work.So, it seems that MkDocs support is very experimental today, and RTD is still primarily targeted for Sphinx projects. But what are the plans in this direction? Are you going to support native mkdocs themes?
At present the theme is hard-coded: https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/doc_builder/backends/mkdocs.py#L147
:+1:
The main reason is because the default mkdocs themes don't have blocks defined, which means we can't override any of the templates. This makes it hard for us to inject some of the page-level context that lets us provide RTD features on top. It's something that we need to get into upstream mkdocs before we can really support it on RTD.
In the meantime, I think it would be good to add to the FAQ that custom themes aren't currently supported when using mkdocs (e.g. after this question). It might also be good to add a note here: https://docs.readthedocs.org/en/latest/theme.html . The current note at the top is a bit vague about what it's referring to.
It wasn't clear to me that custom themes weren't supported until I found this issue.
Agreed with @cjerdonek : I was surprised when my locally-built mkdocs website used the theme I wanted, and that the version on RTD didn't reflect this. Not a _major_ issue, but would be fantastic if they could be implemented, or that a note be made somewhere. Thanks !
Same issue for me. Still not documented.
Adding a note here probably makes most sense: https://github.com/rtfd/readthedocs.org/blob/master/docs/getting_started.rst
AFAICT, this is the only part of the docs that covers MkDocs.
:+1:
The main reason is because the default mkdocs themes don't have blocks defined, which means we can't override any of the templates. This makes it hard for us to inject some of the page-level context that lets us provide RTD features on top. It's something that we need to get into upstream mkdocs before we can really support it on RTD.
@ericholscher What blocks are needed? It would be good if we could define this somewhere, somehow. I'd be then happy to make sure MkDocs conforms to this.
From what I can tell, the only blocks required are for search integration and the the version switcher thing.
Definitely would love to see some progress here. I guess things become even more complicated once the MkDocs themes are only available as part of http://mkdocs.github.io/mkdocs-bootswatch/ anymore.
Not really, that won't complicate anything I don't think.
that won't complicate anything I don't think
Don't want to take this issue OT but wouldn't RTD have to make mkdocs-bootswatch available on their infrastructure _in addition_ to MkDocs?
Users can specify any arbitrary Python packages they want with RTD. If this only allowed MkDocs supported themes it wouldn't be worth the effort :)
Apologies, but I am a bit unclear as to the status of this issue. Is there still work required on MkDocs's side (to define the aforementioned blocks), or we "just" need to make RTD's MkDocs builder check the theme specified in mkdocs.yml and use it if it's there?
@tatablack I believe the work is just needed on the RTD side. It is true that MkDocs could possibly not integrate well if they don't match up with RTD's expectations (but I think this is also true with custom Sphinx themes).
need to make RTD's MkDocs builder check the theme specified in mkdocs.yml and use it if it's there?
It's actually simpler than that. At the moment RTD overwrites whatever theme users specify, to enable other themes RTD just needs to stop overwriting this setting.
Thanks, @d0ugal. I just opened a PR (with an admittedly simplistic solution), let's see how it goes.
What's the status of RTD being able to support custom themes? Would the RTD features, such as the doc flyout be implemented on custom themes?
As it stands, we're opposed to allowing custom themes on mkdocs projects on RTD. The user experience is degraded without the RTD additions to documentation, and to allow custom themes would only further dilute our efforts to a cohesive user experience.
I agree custom themes on Sphinx leads to the same effect, a degraded user experience. I'd much rather a common interface to documentation across projects. At least with Sphinx we have the ability to control parts of the templating process to allow for injection across all themes.
@agjohnson, I agree with the label you put on PR #2188 (Needed: design decision), so I'd like to argue in favour of custom themes.
A little bit strange issue - it's about 2 years but I suppose there is no real understanding what are requirements to be a RTD theme. What should be in MkDocs theme to make it equal to custom Sphinx theme?
If you will decide to shutdown custom themes at all - OK. But while it's allowed it looks like there is no reason to limit MarkDown writers this way in comparison of Sphinx writers.
驴Whats the status of this issue?
I mean, its a won't fix or we can make something to make mkdocs themes compatible with RTD?
As I mentioned in #2188 -- we've decided not to support this, for the reasons listed there.