Skip to content

mkdocs: Values with special ! syntax are set to null on mkdocs.yml #8529

@j1elo

Description

@j1elo

Details

Our project is using:

Expected Result

  1. The cat mkdocs.yml build step should show proper values for env vars READTHEDOCS, READTHEDOCS_VERSION, and READTHEDOCS_PROJECT.

  2. A test html file with these contents:

    console.log("config.extra: {{ config.extra }}");
    console.log("config.extra.READTHEDOCS: {{ config.extra.READTHEDOCS }}");
    console.log("config.extra.READTHEDOCS_VERSION: {{ config.extra.READTHEDOCS_VERSION }}");
    

    should print something similar to this in the browser console:

    config.extra: {'READTHEDOCS': True, 'READTHEDOCS_VERSION': 1.2.3, 'READTHEDOCS_PROJECT': openvidu}
    config.extra.READTHEDOCS: True
    config.extra.READTHEDOCS_VERSION: 1.2.3
    

Actual Result

  1. The cat mkdocs.yml build step shows that READTHEDOCS, READTHEDOCS_VERSION, and READTHEDOCS_PROJECT are all null:

    extra:
      READTHEDOCS: null
      READTHEDOCS_PROJECT: null
      READTHEDOCS_VERSION: null
    
  2. The browser console shows this output:

    config.extra: {'READTHEDOCS': None, 'READTHEDOCS_PROJECT': None, 'READTHEDOCS_VERSION': None}
    config.extra.READTHEDOCS: None
    config.extra.READTHEDOCS_VERSION: None
    

Extra

Question / potential extra bug in the documentation: the technique shown in How do I change behavior when building with Read the Docs? would not really work with MkDocs, would it?

The sample is:

{% if READTHEDOCS %}
Woo
{% endif %}

but in MkDocs the READTHEDOCS is not directly available, is it expected to be? (sorry to ask here but is just a yes/no question that seems very relevant given the topic of the issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions