markdown-environments 1.11.7__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/.github/workflows/publish.yaml +1 -1
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/CONTRIBUTING.md +3 -1
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/PKG-INFO +6 -6
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/README.md +4 -4
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/docs/api.rst +6 -12
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/docs/requirements.txt +1 -1
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/requirements.txt +2 -2
- markdown_environments-2.0.0/src/markdown_environments/__init__.py +27 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/src/markdown_environments/div.py +24 -30
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/src/markdown_environments/dropdown.py +61 -50
- markdown_environments-2.0.0/src/markdown_environments/nested_env.py +260 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/src/markdown_environments/thms.py +130 -97
- markdown_environments-2.0.0/src/markdown_environments/thms_impls_base.py +100 -0
- markdown_environments-2.0.0/src/markdown_environments/utils.py +7 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/success_2_expected.txt +4 -4
- markdown_environments-2.0.0/tests/nested_env/success_3_expected.txt +7 -0
- markdown_environments-1.11.7/tests/cited_blockquote/success_2.txt → markdown_environments-2.0.0/tests/nested_env/success_4.txt +16 -0
- markdown_environments-2.0.0/tests/nested_env/success_4_expected.txt +16 -0
- markdown_environments-2.0.0/tests/nested_env/test_nested_env.py +217 -0
- markdown_environments-2.0.0/tests/nesting/docs_behavior_1.txt +750 -0
- markdown_environments-2.0.0/tests/nesting/docs_behavior_1_expected.txt +448 -0
- markdown_environments-2.0.0/tests/nesting/test_nesting.py +55 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/tests_utils.py +2 -1
- markdown_environments-2.0.0/tests/thms/test_thms.py +115 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/test_thm_counter.py +3 -1
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/test_thm_heading.py +2 -1
- markdown_environments-1.11.7/tests/utils/test_utils.py → markdown_environments-2.0.0/tests/thms_impls_base/test_thms_impls_base.py +29 -41
- markdown_environments-2.0.0/tests/utils/test_utils.py +12 -0
- markdown_environments-1.11.7/src/markdown_environments/__init__.py +0 -20
- markdown_environments-1.11.7/src/markdown_environments/captioned_figure.py +0 -169
- markdown_environments-1.11.7/src/markdown_environments/cited_blockquote.py +0 -167
- markdown_environments-1.11.7/src/markdown_environments/utils.py +0 -88
- markdown_environments-1.11.7/tests/captioned_figure/test_captioned_figure.py +0 -22
- markdown_environments-1.11.7/tests/cited_blockquote/fail_1.txt +0 -11
- markdown_environments-1.11.7/tests/cited_blockquote/fail_1_expected.txt +0 -8
- markdown_environments-1.11.7/tests/cited_blockquote/fail_2.txt +0 -11
- markdown_environments-1.11.7/tests/cited_blockquote/fail_2_expected.txt +0 -8
- markdown_environments-1.11.7/tests/cited_blockquote/fail_3.txt +0 -11
- markdown_environments-1.11.7/tests/cited_blockquote/fail_3_expected.txt +0 -8
- markdown_environments-1.11.7/tests/cited_blockquote/fail_4.txt +0 -11
- markdown_environments-1.11.7/tests/cited_blockquote/fail_4_expected.txt +0 -8
- markdown_environments-1.11.7/tests/cited_blockquote/success_1_expected.txt +0 -8
- markdown_environments-1.11.7/tests/cited_blockquote/success_2_expected.txt +0 -8
- markdown_environments-1.11.7/tests/cited_blockquote/test_cited_blockquote.py +0 -22
- markdown_environments-1.11.7/tests/nesting/success_1.txt +0 -71
- markdown_environments-1.11.7/tests/nesting/success_1_expected.txt +0 -56
- markdown_environments-1.11.7/tests/nesting/test_nesting.py +0 -64
- markdown_environments-1.11.7/tests/thms/test_thms.py +0 -67
- markdown_environments-1.11.7/tests/utils/test_for_env_types_1_expected.txt +0 -1
- markdown_environments-1.11.7/tests/utils/test_for_env_types_2_expected.txt +0 -1
- markdown_environments-1.11.7/tests/utils/test_for_env_types_3_expected.txt +0 -1
- markdown_environments-1.11.7/tests/utils/test_for_env_types_4_expected.txt +0 -1
- markdown_environments-1.11.7/tests/utils/test_for_env_types_5_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/.github/dependabot.yml +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/.gitignore +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/.readthedocs.yaml +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/LICENSE +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/docs/Makefile +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/docs/_static/css/custom.css +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/docs/conf.py +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/docs/contributing.rst +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/docs/example_usage.rst +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/docs/index.rst +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/pyproject.toml +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/__init__.py +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/conftest.py +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/div}/__init__.py +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/div/fail_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/div/fail_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/div/fail_2.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/div/fail_2_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/div/fail_3.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/div/fail_3_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/div/success_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/div/success_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/div/success_2.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/div/success_2_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/div/test_div.py +0 -0
- {markdown_environments-1.11.7/tests/cited_blockquote → markdown_environments-2.0.0/tests/dropdown}/__init__.py +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_2.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_2_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_3.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_3_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_4.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_4_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_5.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_5_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_6.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/fail_6_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/success_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/success_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/success_2.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/success_2_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/dropdown/test_dropdown.py +0 -0
- {markdown_environments-1.11.7/tests/div → markdown_environments-2.0.0/tests/nested_env}/__init__.py +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/fail_1.txt +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/fail_1_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/fail_2.txt +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/fail_2_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/fail_3.txt +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/fail_3_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/fail_4.txt +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/fail_4_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/success_1.txt +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/success_1_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/captioned_figure → markdown_environments-2.0.0/tests/nested_env}/success_2.txt +0 -0
- /markdown_environments-1.11.7/tests/cited_blockquote/success_1.txt → /markdown_environments-2.0.0/tests/nested_env/success_3.txt +0 -0
- {markdown_environments-1.11.7/tests/dropdown → markdown_environments-2.0.0/tests/nesting}/__init__.py +0 -0
- {markdown_environments-1.11.7/tests/nesting → markdown_environments-2.0.0/tests/thms}/__init__.py +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/fail_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/fail_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/fail_2.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/fail_2_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/fail_3.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/fail_3_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_2.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_2_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_3.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_3_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_4.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_4_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_5.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_5_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_6.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_6_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_7.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_7_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_8.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/success_8_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/thms → markdown_environments-2.0.0/tests/thms/thm_counter}/__init__.py +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/fail_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/fail_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/success_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/success_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/success_2.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/success_2_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/success_3.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/success_3_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/success_4.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/success_4_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/success_5.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_counter/success_5_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/thms/thm_counter → markdown_environments-2.0.0/tests/thms/thm_heading}/__init__.py +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/fail_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/fail_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_2.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_2_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_3.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_3_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_4.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_4_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_5.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_5_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_6.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_6_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_7.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_7_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_8.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_heading/success_8_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/thms/thm_heading → markdown_environments-2.0.0/tests/thms/thm_ref}/__init__.py +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/fail_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/fail_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/success_1.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/success_1_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/success_2.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/success_2_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/success_3.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/success_3_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/success_4.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/success_4_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/success_5.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/success_5_expected.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/thms/thm_ref/test_thm_ref.py +0 -0
- {markdown_environments-1.11.7/tests/thms/thm_ref → markdown_environments-2.0.0/tests/thms_impls_base}/__init__.py +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_1.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_1_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_2.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_2_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_3.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_3_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_4.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_4_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_5.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_5_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_6.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_6_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_7.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_7_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_8.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/gen_thm_heading_md_8_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/prepend_thm_heading_md_1.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/prepend_thm_heading_md_1_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/prepend_thm_heading_md_2.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/prepend_thm_heading_md_2_expected.txt +0 -0
- {markdown_environments-1.11.7/tests/utils → markdown_environments-2.0.0/tests/thms_impls_base}/prepend_thm_heading_md_3.txt +0 -0
- /markdown_environments-1.11.7/tests/utils/test_for_env_types_1.txt → /markdown_environments-2.0.0/tests/thms_impls_base/test_method_1.txt +0 -0
- /markdown_environments-1.11.7/tests/utils/test_for_env_types_2.txt → /markdown_environments-2.0.0/tests/thms_impls_base/test_method_2.txt +0 -0
- /markdown_environments-1.11.7/tests/utils/test_for_env_types_3.txt → /markdown_environments-2.0.0/tests/thms_impls_base/test_method_3.txt +0 -0
- /markdown_environments-1.11.7/tests/utils/test_for_env_types_4.txt → /markdown_environments-2.0.0/tests/thms_impls_base/test_method_4.txt +0 -0
- /markdown_environments-1.11.7/tests/utils/test_for_env_types_5.txt → /markdown_environments-2.0.0/tests/thms_impls_base/test_method_5.txt +0 -0
- {markdown_environments-1.11.7 → markdown_environments-2.0.0}/tests/utils/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Contributing
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Feel free to drop an issue or pull request on [GitHub](https://github.com/AnonymousRand/python-markdown-environments) to report bugs or suggest features. Running tests and updating documentation before submitting a pull request would be appreciated ^^
|
|
4
4
|
|
|
5
5
|
## Setting Up Development Environment
|
|
6
6
|
|
|
@@ -21,6 +21,8 @@ Run `hatch test` in the project's root directory. Tests are located in `tests/`;
|
|
|
21
21
|
|
|
22
22
|
(These tests also print out any "incorrect" output, so this can be a good way to test work-in-progress changes without having to set up an actual driver.)
|
|
23
23
|
|
|
24
|
+
Note that there may be some tests called "docs_behavior", which means that them failing isn't necessarily wrong; it just means that new behaviors have appeared that make the docs outdated and in need of updating. For example, this could be some improved behavior like better nesting that is good to keep, but the current docs explicitly warn against users expecting such behavior.
|
|
25
|
+
|
|
24
26
|
## Generating Documentation
|
|
25
27
|
|
|
26
28
|
Module, class, and function documentation are generated automatically from docstrings by `sphinx.ext.autodoc`. To update the documentation, simply update the docstrings in the Python source files in `src/`, and Read the Docs will automatically run Sphinx to regenerate the documentation when I create a new release. Alternatively, to generate the documentation manually for testing, run `make html` in the `docs/` directory and then open `docs/_build/html/index.html` in a browser.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: markdown-environments
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: Highly customizable extensions for Python-Markdown in the style of LaTeX environments/theorems
|
|
5
5
|
Project-URL: Homepage, https://github.com/AnonymousRand/python_markdown_environments
|
|
6
6
|
Project-URL: Documentation, https://python-markdown-environments.readthedocs.io
|
|
@@ -31,7 +31,7 @@ This [Python-Markdown](https://github.com/Python-Markdown/markdown) extension us
|
|
|
31
31
|
...
|
|
32
32
|
\end{...}
|
|
33
33
|
```
|
|
34
|
-
to create environments such as
|
|
34
|
+
to create environments such as general-purpose `<div>`s, dropdowns, nested environments, and user-defined LaTeX-style theorems that can be styled with attached HTML `class`es.
|
|
35
35
|
|
|
36
36
|
## Installation
|
|
37
37
|
|
|
@@ -41,14 +41,14 @@ pip install markdown-environments
|
|
|
41
41
|
|
|
42
42
|
## Available Environments
|
|
43
43
|
|
|
44
|
-
-
|
|
45
|
-
- `\begin{cited_blockquote}`: blockquotes with quote attribution
|
|
46
|
-
- User-defined environments wrapped in general-purpose `<div>`s to style to your heart's content
|
|
44
|
+
- User-defined environments wrapped in general-purpose `<div>`s with customizable HTML classes
|
|
47
45
|
- User-defined environments formatted as `<details>` and `<summary>` dropdowns
|
|
46
|
+
- User-defined nested environments with customizable HTML tags and classes (think a figure with a caption, or a quote with a citation)
|
|
48
47
|
- User-defined LaTeX theorem environments with customizable:
|
|
49
48
|
- Theorem counters
|
|
50
49
|
- Heading punctuation
|
|
51
50
|
- Linkable `id`s by theorem name
|
|
51
|
+
- HTML classes
|
|
52
52
|
|
|
53
53
|
## Documentation
|
|
54
54
|
|
|
@@ -8,7 +8,7 @@ This [Python-Markdown](https://github.com/Python-Markdown/markdown) extension us
|
|
|
8
8
|
...
|
|
9
9
|
\end{...}
|
|
10
10
|
```
|
|
11
|
-
to create environments such as
|
|
11
|
+
to create environments such as general-purpose `<div>`s, dropdowns, nested environments, and user-defined LaTeX-style theorems that can be styled with attached HTML `class`es.
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -18,14 +18,14 @@ pip install markdown-environments
|
|
|
18
18
|
|
|
19
19
|
## Available Environments
|
|
20
20
|
|
|
21
|
-
-
|
|
22
|
-
- `\begin{cited_blockquote}`: blockquotes with quote attribution
|
|
23
|
-
- User-defined environments wrapped in general-purpose `<div>`s to style to your heart's content
|
|
21
|
+
- User-defined environments wrapped in general-purpose `<div>`s with customizable HTML classes
|
|
24
22
|
- User-defined environments formatted as `<details>` and `<summary>` dropdowns
|
|
23
|
+
- User-defined nested environments with customizable HTML tags and classes (think a figure with a caption, or a quote with a citation)
|
|
25
24
|
- User-defined LaTeX theorem environments with customizable:
|
|
26
25
|
- Theorem counters
|
|
27
26
|
- Heading punctuation
|
|
28
27
|
- Linkable `id`s by theorem name
|
|
28
|
+
- HTML classes
|
|
29
29
|
|
|
30
30
|
## Documentation
|
|
31
31
|
|
|
@@ -7,18 +7,6 @@ API Reference
|
|
|
7
7
|
for making sure sphinx can find the classes
|
|
8
8
|
.. currentmodule:: markdown_environments
|
|
9
9
|
|
|
10
|
-
Captioned Figure
|
|
11
|
-
----------------
|
|
12
|
-
|
|
13
|
-
.. autoclass:: CaptionedFigureExtension()
|
|
14
|
-
:members: __init__
|
|
15
|
-
|
|
16
|
-
Cited Blockquote
|
|
17
|
-
----------------
|
|
18
|
-
|
|
19
|
-
.. autoclass:: CitedBlockquoteExtension()
|
|
20
|
-
:members: __init__
|
|
21
|
-
|
|
22
10
|
Div
|
|
23
11
|
---
|
|
24
12
|
|
|
@@ -31,6 +19,12 @@ Dropdown
|
|
|
31
19
|
.. autoclass:: DropdownExtension()
|
|
32
20
|
:members: __init__
|
|
33
21
|
|
|
22
|
+
Div
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
.. autoclass:: NestedEnvExtension()
|
|
26
|
+
:members: __init__
|
|
27
|
+
|
|
34
28
|
Thms
|
|
35
29
|
----
|
|
36
30
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
alabaster==1.0.0
|
|
2
|
-
anyio==4.
|
|
2
|
+
anyio==4.14.2
|
|
3
3
|
astroid==3.3.8
|
|
4
4
|
babel==2.16.0
|
|
5
5
|
backports.tarfile==1.2.0
|
|
@@ -52,7 +52,7 @@ SecretStorage==3.3.3
|
|
|
52
52
|
shellingham==1.5.4
|
|
53
53
|
sniffio==1.3.1
|
|
54
54
|
snowballstemmer==2.2.0
|
|
55
|
-
soupsieve==2.
|
|
55
|
+
soupsieve==2.9.0
|
|
56
56
|
Sphinx==8.1.3
|
|
57
57
|
sphinx-autoapi==3.4.0
|
|
58
58
|
sphinx-rtd-theme==3.0.2
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
r"""
|
|
2
|
+
The base Markdown syntax defined by this extension is::
|
|
3
|
+
|
|
4
|
+
\begin{...}
|
|
5
|
+
...
|
|
6
|
+
\end{...}
|
|
7
|
+
|
|
8
|
+
Important:
|
|
9
|
+
- Each `\\begin{}` must be on its own line with a blank line above, and each `\\end{}` must be
|
|
10
|
+
on its own line with a blank line below.
|
|
11
|
+
- In general, don't expect nesting environments to work consistently unless they are of
|
|
12
|
+
different types; the behavior is undefined otherwise. This includes not being able to nest
|
|
13
|
+
environments that are themselves "nested" or "multiple-layered" (`Dropdown`s and `NestedEnv`s)
|
|
14
|
+
within themselves even if they are different "types" in the config, e.g. exercise vs proof
|
|
15
|
+
dropdowns. The only exception currently is that `Div` environments *can* be nested within
|
|
16
|
+
other `Div`s of different config "types", but I would still recommend avoiding such
|
|
17
|
+
complicated setups if you can avoid it. For a full list of which combinations work and
|
|
18
|
+
which don't, refer to `tests/nesting/docs_behavior_1_expected.txt` inside the source repo.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from .div import DivExtension
|
|
22
|
+
from .dropdown import DropdownExtension
|
|
23
|
+
from .nested_env import NestedEnvExtension
|
|
24
|
+
from .thms import ThmsExtension
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
__version__ = "2.0.0"
|
{markdown_environments-1.11.7 → markdown_environments-2.0.0}/src/markdown_environments/div.py
RENAMED
|
@@ -5,33 +5,27 @@ from markdown.blockprocessors import BlockProcessor
|
|
|
5
5
|
from markdown.extensions import Extension
|
|
6
6
|
|
|
7
7
|
from . import utils
|
|
8
|
+
from .thms_impls_base import ThmsImplsBase
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
class DivProcessor(BlockProcessor):
|
|
11
|
+
class DivProcessor(BlockProcessor, ThmsImplsBase):
|
|
11
12
|
|
|
12
13
|
def __init__(self, *args, types: dict, html_class: str, is_thm: bool, **kwargs):
|
|
13
|
-
|
|
14
|
+
BlockProcessor.__init__(self, *args, **kwargs)
|
|
15
|
+
ThmsImplsBase.__init__(self, types=types, is_thm=is_thm);
|
|
14
16
|
self.html_class = html_class
|
|
15
|
-
self.is_thm = is_thm
|
|
16
|
-
self.types, self.start_pattern_choices, self.end_pattern_choices = utils.init_env_types(types, self.is_thm)
|
|
17
|
-
self.start_pattern = None
|
|
18
|
-
self.end_pattern = None
|
|
19
17
|
|
|
18
|
+
# this is technically not required, but it makes the multiple inheritance situation (where
|
|
19
|
+
# `ThmsImplsBase` is implementing this method required for `BlockProcessor`s) more explicit
|
|
20
20
|
def test(self, parent, block):
|
|
21
|
-
|
|
22
|
-
if typ == "":
|
|
23
|
-
return False
|
|
24
|
-
self.type_opts = self.types[typ]
|
|
25
|
-
self.start_pattern = self.start_pattern_choices[typ]
|
|
26
|
-
self.end_pattern = self.end_pattern_choices[typ]
|
|
27
|
-
return True
|
|
21
|
+
return ThmsImplsBase.test(self, parent, block)
|
|
28
22
|
|
|
29
23
|
def run(self, parent, blocks):
|
|
30
24
|
org_block_start = blocks[0]
|
|
31
25
|
# generate default thm heading if applicable
|
|
32
26
|
thm_heading_md = ""
|
|
33
27
|
if self.is_thm:
|
|
34
|
-
thm_heading_md =
|
|
28
|
+
thm_heading_md = self.gen_thm_heading_md(blocks[0])
|
|
35
29
|
# remove starting delim (after generating thm heading from it, if applicable)
|
|
36
30
|
blocks[0] = self.start_pattern.sub("", blocks[0])
|
|
37
31
|
|
|
@@ -46,13 +40,13 @@ class DivProcessor(BlockProcessor):
|
|
|
46
40
|
elem = etree.SubElement(parent, "div")
|
|
47
41
|
if self.html_class != "" or self.type_opts.get("html_class") != "":
|
|
48
42
|
elem.set("class", f"{self.html_class} {self.type_opts.get('html_class')}")
|
|
49
|
-
blocks[i] = blocks[i].rstrip() # remove
|
|
43
|
+
blocks[i] = blocks[i].rstrip() # remove whitespace from newline after `\end{}`
|
|
50
44
|
self.parser.parseBlocks(elem, blocks[0:i + 1])
|
|
51
45
|
# remove used blocks
|
|
52
46
|
for _ in range(0, i + 1):
|
|
53
47
|
blocks.pop(0)
|
|
54
48
|
# add thm heading if applicable
|
|
55
|
-
|
|
49
|
+
ThmsImplsBase.prepend_thm_heading_md(elem, thm_heading_md)
|
|
56
50
|
break
|
|
57
51
|
# if no ending delim, restore and do nothing
|
|
58
52
|
if not delim_found:
|
|
@@ -90,24 +84,28 @@ class DivExtension(Extension):
|
|
|
90
84
|
|
|
91
85
|
.. code-block:: html
|
|
92
86
|
|
|
93
|
-
<div class="[html_class] [type
|
|
87
|
+
<div class="[html_class] [type.html_class]">
|
|
94
88
|
[content]
|
|
95
89
|
</div>
|
|
96
90
|
"""
|
|
97
91
|
|
|
98
92
|
def __init__(self, **kwargs):
|
|
99
93
|
r"""
|
|
100
|
-
Initialize div extension, with configuration options passed as the following keyword
|
|
94
|
+
Initialize div extension, with configuration options passed as the following keyword
|
|
95
|
+
arguments:
|
|
101
96
|
|
|
102
97
|
- **types** (*dict*) -- Types of div environments to define. Defaults to `{}`.
|
|
103
|
-
- **html_class** (*str*) -- HTML `class` attribute to add to divs. Defaults to `""`.
|
|
98
|
+
- **html_class** (*str*) -- HTML `class` attribute to add to all divs. Defaults to `""`.
|
|
99
|
+
|
|
100
|
+
The key for each type defined in `types` is inserted directly into the regex patterns
|
|
101
|
+
that search for `\\begin{<type>}` and `\\end{<type>}`, so anything you specify will be
|
|
102
|
+
interpreted as regex. (However, if the key is an empty string, its regex will never be
|
|
103
|
+
matched against, so it is effectively useless.)
|
|
104
104
|
|
|
105
|
-
The key for each type defined in `types` is inserted directly into the regex patterns that search for
|
|
106
|
-
`\\begin{<type>}` and `\\end{<type>}`, so anything you specify will be interpreted as regex. However,
|
|
107
|
-
if the key is an empty string, its regex will never be matched against, so it is effectively useless.
|
|
108
105
|
In addition, each type's value is itself a dictionary with the following possible options:
|
|
109
106
|
|
|
110
|
-
- **html_class** (*str*) -- HTML `class` attribute to add to divs of that type.
|
|
107
|
+
- **html_class** (*str*) -- HTML `class` attribute to add to divs of that type.
|
|
108
|
+
Defaults to `""`.
|
|
111
109
|
"""
|
|
112
110
|
|
|
113
111
|
self.config = {
|
|
@@ -117,22 +115,18 @@ class DivExtension(Extension):
|
|
|
117
115
|
],
|
|
118
116
|
"html_class": [
|
|
119
117
|
"",
|
|
120
|
-
"HTML `class` attribute to add to
|
|
118
|
+
"HTML `class` attribute to add to all divs. Defaults to `\"\"`."
|
|
121
119
|
],
|
|
122
120
|
"is_thm": [
|
|
123
121
|
False,
|
|
124
122
|
(
|
|
125
|
-
"Whether to use theorem logic (e.g. heading); you shouldn't have to set
|
|
126
|
-
"Defaults to `False`."
|
|
123
|
+
"Whether to use theorem logic (e.g. heading); you shouldn't have to set "
|
|
124
|
+
"this value manually. Defaults to `False`."
|
|
127
125
|
)
|
|
128
126
|
]
|
|
129
127
|
}
|
|
130
128
|
utils.init_extension_with_configs(self, **kwargs)
|
|
131
129
|
|
|
132
|
-
# set default options for individual types
|
|
133
|
-
for type, opts in self.getConfig("types").items():
|
|
134
|
-
opts.setdefault("html_class", "")
|
|
135
|
-
|
|
136
130
|
def extendMarkdown(self, md):
|
|
137
131
|
md.parser.blockprocessors.register(DivProcessor(md.parser, **self.getConfigs()), "div", 105)
|
|
138
132
|
|
{markdown_environments-1.11.7 → markdown_environments-2.0.0}/src/markdown_environments/dropdown.py
RENAMED
|
@@ -5,9 +5,10 @@ from markdown.blockprocessors import BlockProcessor
|
|
|
5
5
|
from markdown.extensions import Extension
|
|
6
6
|
|
|
7
7
|
from . import utils
|
|
8
|
+
from .thms_impls_base import ThmsImplsBase
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
class DropdownProcessor(BlockProcessor):
|
|
11
|
+
class DropdownProcessor(BlockProcessor, ThmsImplsBase):
|
|
11
12
|
|
|
12
13
|
SUMMARY_START_REGEX = re.compile(r"^\\begin{summary}", flags=re.MULTILINE)
|
|
13
14
|
SUMMARY_END_REGEX = re.compile(r"^\\end{summary}", flags=re.MULTILINE)
|
|
@@ -16,37 +17,33 @@ class DropdownProcessor(BlockProcessor):
|
|
|
16
17
|
self, *args, types: dict, html_class: str, summary_html_class: str, content_html_class: str,
|
|
17
18
|
is_thm: bool, **kwargs
|
|
18
19
|
):
|
|
19
|
-
|
|
20
|
+
BlockProcessor.__init__(self, *args, **kwargs)
|
|
21
|
+
ThmsImplsBase.__init__(self, types=types, is_thm=is_thm);
|
|
20
22
|
self.html_class = html_class
|
|
21
23
|
self.summary_html_class = summary_html_class
|
|
22
24
|
self.content_html_class = content_html_class
|
|
23
|
-
self.is_thm = is_thm
|
|
24
|
-
self.types, self.start_pattern_choices, self.end_pattern_choices = utils.init_env_types(types, self.is_thm)
|
|
25
|
-
self.start_pattern = None
|
|
26
|
-
self.end_pattern = None
|
|
27
25
|
|
|
26
|
+
# this is technically not required, but it makes the multiple inheritance situation (where
|
|
27
|
+
# `ThmsImplsBase` is implementing this method required for `BlockProcessor`s) more explicit
|
|
28
28
|
def test(self, parent, block):
|
|
29
|
-
|
|
30
|
-
if typ == "":
|
|
31
|
-
return False
|
|
32
|
-
self.type_opts = self.types[typ]
|
|
33
|
-
self.start_pattern = self.start_pattern_choices[typ]
|
|
34
|
-
self.end_pattern = self.end_pattern_choices[typ]
|
|
35
|
-
return True
|
|
29
|
+
return ThmsImplsBase.test(self, parent, block)
|
|
36
30
|
|
|
37
31
|
def run(self, parent, blocks):
|
|
38
|
-
# guard against index out of bounds on matching `self.SUMMARY_START_REGEX` for recursive
|
|
32
|
+
# guard against index out of bounds on matching `self.SUMMARY_START_REGEX` for recursive
|
|
33
|
+
# `run()` parsing
|
|
39
34
|
if len(blocks) < 2:
|
|
40
35
|
return False
|
|
41
36
|
org_blocks = list(blocks)
|
|
42
37
|
# remove summary starting delim that must immediately follow dropdown's starting delim
|
|
43
|
-
# if no starting delim for summary and not a thm dropdown which should provide a default,
|
|
38
|
+
# if no starting delim for summary and not a thm dropdown which should provide a default,
|
|
39
|
+
# restore and do nothing
|
|
44
40
|
has_summary = True
|
|
45
41
|
if not self.SUMMARY_START_REGEX.match(blocks[1]):
|
|
46
42
|
if self.is_thm:
|
|
47
43
|
has_summary = False
|
|
48
44
|
else:
|
|
49
|
-
|
|
45
|
+
# `blocks = org_blocks` doesn't work; must mutate `blocks` instead of reassigning it
|
|
46
|
+
blocks.clear()
|
|
50
47
|
blocks.extend(org_blocks)
|
|
51
48
|
return False
|
|
52
49
|
blocks[1] = self.SUMMARY_START_REGEX.sub("", blocks[1])
|
|
@@ -55,19 +52,22 @@ class DropdownProcessor(BlockProcessor):
|
|
|
55
52
|
# also first generate theorem heading from it to use as default summary if applicable
|
|
56
53
|
thm_heading_md = ""
|
|
57
54
|
if self.is_thm:
|
|
58
|
-
thm_heading_md =
|
|
55
|
+
thm_heading_md = self.gen_thm_heading_md(blocks[0])
|
|
59
56
|
blocks[0] = self.start_pattern.sub("", blocks[0])
|
|
60
57
|
|
|
61
|
-
# find and remove summary ending delim if summary starting delim was present,
|
|
62
|
-
#
|
|
58
|
+
# find and remove summary ending delim if summary starting delim was present,
|
|
59
|
+
# and extract element
|
|
60
|
+
# (`summary_elem` is initialized outside the loop since the loop isn't guaranteed here
|
|
61
|
+
# to find and initialize it)
|
|
63
62
|
summary_elem = etree.Element("summary")
|
|
64
63
|
if self.summary_html_class != "":
|
|
65
64
|
summary_elem.set("class", self.summary_html_class)
|
|
66
65
|
has_valid_summary = self.is_thm
|
|
67
66
|
if has_summary:
|
|
68
67
|
for i, block in enumerate(blocks):
|
|
69
|
-
# if we haven't found summary ending delim but have found the overall dropdown
|
|
70
|
-
# then don't keep going; maybe the summary was omitted as it was
|
|
68
|
+
# if we haven't found summary ending delim but have found the overall dropdown
|
|
69
|
+
# ending delim, then don't keep going; maybe the summary was omitted as it was
|
|
70
|
+
# optional for theorems
|
|
71
71
|
if self.end_pattern.search(block):
|
|
72
72
|
break
|
|
73
73
|
if self.SUMMARY_END_REGEX.search(block):
|
|
@@ -75,7 +75,7 @@ class DropdownProcessor(BlockProcessor):
|
|
|
75
75
|
# remove ending delim
|
|
76
76
|
blocks[i] = self.SUMMARY_END_REGEX.sub("", block)
|
|
77
77
|
# build HTML for summary
|
|
78
|
-
blocks[i] = blocks[i].rstrip() # remove
|
|
78
|
+
blocks[i] = blocks[i].rstrip() # remove whitespace from newline after `\end{}`
|
|
79
79
|
self.parser.parseBlocks(summary_elem, blocks[:i + 1])
|
|
80
80
|
# remove used blocks
|
|
81
81
|
for _ in range(i + 1):
|
|
@@ -86,8 +86,9 @@ class DropdownProcessor(BlockProcessor):
|
|
|
86
86
|
blocks.clear()
|
|
87
87
|
blocks.extend(org_blocks)
|
|
88
88
|
return False
|
|
89
|
-
# prepend thm heading (including default summary) to summary if applicable,
|
|
90
|
-
|
|
89
|
+
# prepend thm heading (including default summary) to summary if applicable,
|
|
90
|
+
# again outside the loop
|
|
91
|
+
ThmsImplsBase.prepend_thm_heading_md(summary_elem, thm_heading_md)
|
|
91
92
|
|
|
92
93
|
# find and remove dropdown ending delim, and extract element
|
|
93
94
|
delim_found = False
|
|
@@ -99,12 +100,14 @@ class DropdownProcessor(BlockProcessor):
|
|
|
99
100
|
# build HTML for dropdown
|
|
100
101
|
details_elem = etree.SubElement(parent, "details")
|
|
101
102
|
if self.html_class != "" or self.type_opts.get("html_class") != "":
|
|
102
|
-
details_elem.set(
|
|
103
|
+
details_elem.set(
|
|
104
|
+
"class", f"{self.html_class} {self.type_opts.get('html_class')}"
|
|
105
|
+
)
|
|
103
106
|
details_elem.append(summary_elem)
|
|
104
107
|
content_elem = etree.SubElement(details_elem, "div")
|
|
105
108
|
if self.content_html_class != "":
|
|
106
109
|
content_elem.set("class", self.content_html_class)
|
|
107
|
-
blocks[i] = blocks[i].rstrip() # remove
|
|
110
|
+
blocks[i] = blocks[i].rstrip() # remove whitespace from newline after `\end{}`
|
|
108
111
|
self.parser.parseBlocks(content_elem, blocks[0:i + 1])
|
|
109
112
|
# remove used blocks
|
|
110
113
|
for _ in range(0, i + 1):
|
|
@@ -120,7 +123,8 @@ class DropdownProcessor(BlockProcessor):
|
|
|
120
123
|
|
|
121
124
|
class DropdownExtension(Extension):
|
|
122
125
|
r"""
|
|
123
|
-
A dropdown that can be toggled open or closed, with only a preview portion (`<summary>`)
|
|
126
|
+
A dropdown that can be toggled open or closed, with only a preview portion (`<summary>`)
|
|
127
|
+
shown when closed.
|
|
124
128
|
|
|
125
129
|
Usage:
|
|
126
130
|
.. code-block:: py
|
|
@@ -155,7 +159,7 @@ class DropdownExtension(Extension):
|
|
|
155
159
|
|
|
156
160
|
.. code-block:: html
|
|
157
161
|
|
|
158
|
-
<details class="[html_class] [type
|
|
162
|
+
<details class="[html_class] [type.html_class]">
|
|
159
163
|
<summary class="[summary_html_class]">
|
|
160
164
|
[summary]
|
|
161
165
|
</summary>
|
|
@@ -166,25 +170,31 @@ class DropdownExtension(Extension):
|
|
|
166
170
|
</details>
|
|
167
171
|
|
|
168
172
|
Important:
|
|
169
|
-
The `summary` block must be placed at the *start* of the `dropdown` block, of course
|
|
170
|
-
after the `summary` block.
|
|
173
|
+
The `summary` block must be placed at the *start* of the `dropdown` block, of course
|
|
174
|
+
with blank lines before and after the `summary` block.
|
|
171
175
|
"""
|
|
172
176
|
|
|
173
177
|
def __init__(self, **kwargs):
|
|
174
178
|
r"""
|
|
175
|
-
Initialize dropdown extension, with configuration options passed as the following keyword
|
|
179
|
+
Initialize dropdown extension, with configuration options passed as the following keyword
|
|
180
|
+
arguments:
|
|
176
181
|
|
|
177
182
|
- **types** (*dict*) -- Types of dropdown environments to define. Defaults to `{}`.
|
|
178
|
-
- **html_class** (*str*) -- HTML `class` attribute to add to dropdowns.
|
|
179
|
-
|
|
180
|
-
- **
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
- **html_class** (*str*) -- HTML `class` attribute to add to all dropdowns.
|
|
184
|
+
Defaults to `""`.
|
|
185
|
+
- **summary_html_class** (*str*) -- HTML `class` attribute to add to all dropdown
|
|
186
|
+
summaries. Defaults to `""`.
|
|
187
|
+
- **content_html_class** (*str*) -- HTML `class` attribute to add to all dropdown
|
|
188
|
+
contents. Defaults to `""`.
|
|
189
|
+
|
|
190
|
+
The key for each type defined in `types` is inserted directly into the regex patterns
|
|
191
|
+
that search for `\\begin{<type>}` and `\\end{<type>}`, so anything you specify will be
|
|
192
|
+
interpreted as regex. (However, if the key is an empty string, its regex will never be
|
|
193
|
+
matched against, so it is effectively useless.) In addition, each type's value is itself
|
|
194
|
+
a dictionary with the following possible options:
|
|
195
|
+
|
|
196
|
+
- **html_class** (*str*) -- HTML `class` attribute to add to dropdowns of that type.
|
|
197
|
+
Defaults to `""`.
|
|
188
198
|
"""
|
|
189
199
|
|
|
190
200
|
self.config = {
|
|
@@ -194,29 +204,30 @@ class DropdownExtension(Extension):
|
|
|
194
204
|
],
|
|
195
205
|
"html_class": [
|
|
196
206
|
"",
|
|
197
|
-
"HTML `class` attribute to add to
|
|
207
|
+
"HTML `class` attribute to add to all dropdowns. Defaults to `\"\"`."
|
|
198
208
|
],
|
|
199
209
|
"summary_html_class": [
|
|
200
210
|
"",
|
|
201
|
-
"HTML `class` attribute to add to dropdown
|
|
211
|
+
"HTML `class` attribute to add to all dropdown summaries. Defaults to `\"\"`."
|
|
202
212
|
],
|
|
203
213
|
"content_html_class": [
|
|
204
214
|
"",
|
|
205
|
-
"HTML `class` attribute to add to dropdown
|
|
215
|
+
"HTML `class` attribute to add to all dropdown contents. Defaults to `\"\"`."
|
|
206
216
|
],
|
|
207
217
|
"is_thm": [
|
|
208
218
|
False,
|
|
209
|
-
|
|
219
|
+
(
|
|
220
|
+
"Whether to use theorem logic (e.g. heading); used only by `ThmExtension`. "
|
|
221
|
+
"Defaults to `False`."
|
|
222
|
+
)
|
|
210
223
|
]
|
|
211
224
|
}
|
|
212
225
|
utils.init_extension_with_configs(self, **kwargs)
|
|
213
226
|
|
|
214
|
-
# set default options for individual types
|
|
215
|
-
for type, opts in self.getConfig("types").items():
|
|
216
|
-
opts.setdefault("html_class", "")
|
|
217
|
-
|
|
218
227
|
def extendMarkdown(self, md):
|
|
219
|
-
md.parser.blockprocessors.register(
|
|
228
|
+
md.parser.blockprocessors.register(
|
|
229
|
+
DropdownProcessor(md.parser, **self.getConfigs()), "dropdown", 105
|
|
230
|
+
)
|
|
220
231
|
|
|
221
232
|
|
|
222
233
|
def makeExtension(**kwargs):
|