Skip to content

CSS can conflict with parent rules #9

@dmorrison42

Description

@dmorrison42

With certain parent CSS rules, it is possible to break styling (accidentally).

This can be seen with this Sphinx theme https://github.com/snide/sphinx_rtd_theme.

For example see the template below:

{% extends "!layout.html" %}

{%- block extrahead %} 
<script src="/_static/json-schema-view.min.js"></script>
<link rel="stylesheet" href="/_static/json-schema-view.min.css"></script>
<script>
window.addEventListener('load', function () {
    var view;
    var codeBlocks = document.getElementsByClassName('highlight-jsonschema');
    for (var i = 0; i < codeBlocks.length; i++) {
        try {
            view = new JSONSchemaView(JSON.parse(codeBlocks[i].textContent));
        } catch (e) {
            console.log(e)
        }
        codeBlocks[i].parentElement.replaceChild(view.render(), codeBlocks[i]);
    }
});
</script>
<style>
.json-schema-view .property, 
json-schema-view .property {
    display: table-row !important;
}
</style>
{% endblock %}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions