1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-30 18:24:35 +01:00

Added compatibility for mkdocs 0.17

This commit is contained in:
squidfunk 2017-10-22 21:22:25 +02:00 committed by Martin Donath
parent badeb7e86f
commit 4060ad09d9
6 changed files with 13 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -164,7 +164,7 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application-268d62d82d.js"></script> <script src="{{ base_url }}/assets/javascripts/application-946997f430.js"></script>
{% set languages = lang.t("search.languages").split(",") %} {% set languages = lang.t("search.languages").split(",") %}
{% if languages | length and languages[0] != "" %} {% if languages | length and languages[0] != "" %}
{% set path = base_url + "/assets/javascripts/lunr" %} {% set path = base_url + "/assets/javascripts/lunr" %}
@ -181,7 +181,7 @@
<script src="{{ path }}/lunr.multi.js"></script> <script src="{{ path }}/lunr.multi.js"></script>
{% endif %} {% endif %}
{% endif %} {% endif %}
<script>app.initialize({url:{base:"{{ base_url }}"}})</script> <script>app.initialize({version:"{{ mkdocs_version }}",url:{base:"{{ base_url }}"}})</script>
{% for path in extra_javascript %} {% for path in extra_javascript %}
<script src="{{ path }}"></script> <script src="{{ path }}"></script>
{% endfor %} {% endfor %}

View File

@ -18,6 +18,6 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE. # IN THE SOFTWARE.
mkdocs==0.16.3 mkdocs>=0.16
Pygments>=2.2 Pygments>=2.2
pymdown-extensions>=3.4 pymdown-extensions>=3.4

View File

@ -225,7 +225,9 @@ function initialize(config) { // eslint-disable-line func-style
new Material.Event.Listener("[data-md-component=query]", [ new Material.Event.Listener("[data-md-component=query]", [
"focus", "keyup", "change" "focus", "keyup", "change"
], new Material.Search.Result("[data-md-component=result]", () => { ], new Material.Search.Result("[data-md-component=result]", () => {
return fetch(`${config.url.base}/mkdocs/search_index.json`, { return fetch(`${config.url.base}/${
config.version < "0.17" ? "mkdocs" : "search"
}/search_index.json`, {
credentials: "same-origin" credentials: "same-origin"
}).then(response => response.json()) }).then(response => response.json())
.then(data => { .then(data => {

View File

@ -320,7 +320,12 @@
<!-- Initialize application --> <!-- Initialize application -->
<script> <script>
app.initialize({ url: { base: "{{ base_url }}" } }); app.initialize({
version: "{{ mkdocs_version }}",
url: {
base: "{{ base_url }}"
}
});
</script> </script>
{% for path in extra_javascript %} {% for path in extra_javascript %}
<script src="{{ path }}"></script> <script src="{{ path }}"></script>