A community-maintained Python framework for creating mathematical animations.
Add inheritance diagrams to reference page (#1441)
Anton Ballmaier2d2604bca9dd
diff --git a/docs/source/_static/responsiveSvg.js b/docs/source/_static/responsiveSvg.jsnew file mode 100644index 000000000..6c359a4d8--- /dev/null+++ b/docs/source/_static/responsiveSvg.js@@ -0,0 +1,67 @@++window.addEventListener("load", function () {+ const styleElements = []+ const colorSchemeQuery = window.matchMedia('(prefers-color-scheme: dark)');+ const diagrams = document.querySelectorAll("object.inheritance.graphviz");++ for (let diagram of diagrams) {+ style = document.createElement('style');+ styleElements.push(style);+ console.log(diagram);+ diagram.contentDocument.firstElementChild.appendChild(style);+ }++ function setColorScheme(e) {+ let colors, additions = "";+ if (e.matches) {+ // Dark+ colors = {+ text: "#e07a5f",+ box: "#383838",+ edge: "#d0d0d0",+ background: "#131416"+ };+ } else {+ // Light+ colors = {+ text: "#e07a5f",+ box: "#fff",+ edge: "#413c3c",+ background: "#f1ece9"+ };+ additions = `+ .node polygon {+ filter: drop-shadow(0 1px 3px #0002);+ }+ `+ }+ for (let style of styleElements) {+ style.innerHTML = `+ svg {+ background-color: ${colors.background};+ }++ .node text {+ fill: ${colors.text};+ }++ .node polygon {+ fill: ${colors.box};+ }++ .edge polygon {+ fill: ${colors.edge};+ stroke: ${colors.edge};+ }++ .edge path {+ stroke: ${colors.edge};+ }+ ${additions}+ `;+ }+ }++ setColorScheme(colorSchemeQuery);+ colorSchemeQuery.addEventListener("change", setColorScheme);+});diff --git a/docs/source/conf.py b/docs/source/conf.pyindex 0beeac5ad..fb7ef861e 100644--- a/docs/source/conf.py+++ b/docs/source/conf.py@@ -57,6 +57,8 @@ extensions = ["sphinx.ext.viewcode","sphinxext.opengraph","manim_directive",+ "sphinx.ext.graphviz",+ "sphinx.ext.inheritance_diagram",]# Automatically generate stub pages when using the .. autosummary directive@@ -138,3 +140,27 @@ extlinks = {ogp_image = "https://www.manim.community/logo.png"ogp_site_name = "Manim Community | Documentation"ogp_site_url = "https://docs.manim.community/"+++# inheritance_graph settings+inheritance_graph_attrs = dict(+ concentrate=True,+ size='""',+ splines="ortho",+ nodesep=0.1,+ ranksep=0.2,+)++inheritance_node_attrs = dict(+ penwidth=0, shape="box", width=0.05, height=0.05, margin=0.05+)++inheritance_edge_attrs = dict(+ penwidth=1,+)++html_js_files = [+ "responsiveSvg.js",+]++graphviz_output_format = "svg"diff --git a/docs/source/contributing/development.rst b/docs/source/contributing/development.rstindex 076c75398..a932d5323 100644--- a/docs/source/contributing/development.rst+++ b/docs/source/contributing/development.rst@@ -41,7 +41,7 @@ For first-time contributorsgit remote add upstream https://github.com/ManimCommunity/manim.git-#. Now, ``git remote -v`` should show two remote repositores named:+#. Now, ``git remote -v`` should show two remote repositories named:- ``origin``, your forked repository- ``upstream`` the ManimCommunity repository@@ -214,7 +214,8 @@ sticks to our coding conventions.to your pull request. Make sure not to introduce any Sphinx errors, and havea look at the built HTML files to see whether the formatting of the documentationyou added looks as you intended. You can build the documentation locally- by running ``make html`` from the ``docs`` directory.+ by running ``make html`` from the ``docs`` directory. Since the inheritance diagrams+ require you to have `Graphviz <https://graphviz.org/>`_ installed locally.Finally, if the pipeline passes and you are satisfied with your changes: wait forfeedback and iterate over any requested changes. You will likely be asked todiff --git a/docs/source/reference.rst b/docs/source/reference.rstindex a3f1fbe53..d98e62477 100644--- a/docs/source/reference.rst+++ b/docs/source/reference.rst@@ -47,6 +47,42 @@ Mobjects~mobject.types.point_cloud_mobject~mobject.types.vectorized_mobject+**Mobject** Inheritance Graph+~~~~~~~~~~~~~~~~~~~~~~~~~~++.. inheritance-diagram::+ manim.mobject.changing+ manim.mobject.coordinate_systems+ manim.mobject.frame+ manim.mobject.functions+ manim.mobject.geometry+ manim.mobject.graph+ manim.mobject.logo+ manim.mobject.matrix+ manim.mobject.mobject+ manim.mobject.mobject_update_utils+ manim.mobject.number_line+ manim.mobject.numbers+ manim.mobject.probability+ manim.mobject.shape_matchers+ manim.mobject.three_d_utils+ manim.mobject.three_dimensions+ manim.mobject.value_tracker+ manim.mobject.vector_field+ manim.mobject.svg.brace+ manim.mobject.svg.code_mobject+ manim.mobject.svg.style_utils+ manim.mobject.svg.svg_path+ manim.mobject.svg.svg_mobject+ manim.mobject.svg.tex_mobject+ manim.mobject.svg.text_mobject+ manim.mobject.types.image_mobject+ manim.mobject.types.point_cloud_mobject+ manim.mobject.types.vectorized_mobject+ :parts: 1+ :top-classes: manim.mobject.mobject.Mobject++******Scenes@@ -65,6 +101,22 @@ Scenes~scene.vector_space_scene~scene.zoomed_scene+**Scene** Inheritance Graph+~~~~~~~~~~~~~~~~~~~~~~~~++.. inheritance-diagram::+ manim.scene.graph_scene+ manim.scene.moving_camera_scene+ manim.scene.reconfigurable_scene+ manim.scene.sample_space_scene+ manim.scene.scene+ manim.scene.scene_file_writer+ manim.scene.three_d_scene+ manim.scene.vector_space_scene+ manim.scene.zoomed_scene+ :parts: 1+ :top-classes: manim.scene.scene.Scene, manim.scene.scene.RerunSceneHandler+**********Animations@@ -86,6 +138,25 @@ Animations~animation.transform_matching_parts~animation.update+**Animation** Inheritance Graph+~~~~~~~~~~~~~~~~~~~~~~~~~~~~++.. inheritance-diagram::+ manim.animation.animation+ manim.animation.composition+ manim.animation.creation+ manim.animation.fading+ manim.animation.growing+ manim.animation.indication+ manim.animation.movement+ manim.animation.numbers+ manim.animation.rotation+ manim.animation.transform+ manim.animation.transform_matching_parts+ manim.animation.update+ :parts: 1+ :top-classes: manim.animation.animation.Animation+*******Cameras@@ -100,6 +171,17 @@ Cameras~camera.multi_camera~camera.three_d_camera+**Camera** Inheritance Graph+~~~~~~~~~~~~~~~~~~~~~~~~~++.. inheritance-diagram::+ manim.camera.camera+ manim.camera.mapping_camera+ manim.camera.moving_camera+ manim.camera.multi_camera+ manim.camera.three_d_camera+ :parts: 1+ :top-classes: manim.camera.camera.Camera, manim.mobject.mobject.Mobject*************Configuration@@ -146,4 +228,4 @@ Other modules:toctree: referenceconstants- container+ container