Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistune #67

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@ github_project = spacetelescope/sphinx-asdf

[options]
packages = find:
python_requires = >=3.6
python_requires = >=3.9
include_package_data = True
setup_requires = setuptools_scm
install_requires =
asdf
astropy>=5.0.4
docutils
graphviz
matplotlib
myst-parser
mistune~=0.8.4
mistune
sphinx
sphinx-astropy
sphinx_bootstrap_theme
Expand Down
2 changes: 1 addition & 1 deletion sphinx_asdf/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
latex_logo = f"{static_dir}/logo.pdf"

sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname("__file__")), "sphinxext"))
extensions += ["sphinx_asdf", "sphinx_inline_tabs", "myst_parser"]
extensions += ["sphinx_asdf", "sphinx_inline_tabs"]
10 changes: 9 additions & 1 deletion sphinx_asdf/directives.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import posixpath
from pprint import pformat

import mistune
import yaml
from docutils import nodes
from docutils.parsers.rst import directives
from docutils.statemachine import ViewList
from mistune.renderers.rst import RSTRenderer
from sphinx import addnodes
from sphinx.util.docutils import SphinxDirective
from sphinx.util.nodes import nested_parse_with_titles

from .md2rst import md2rst
from .nodes import (
asdf_ref,
asdf_tree,
Expand Down Expand Up @@ -44,6 +45,10 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)


def _math_to_rst(renderer, txt, block_state):
return f":math:{txt}"


class AsdfAutoschemas(SphinxDirective):
required_arguments = 0
optional_arguments = 2
Expand Down Expand Up @@ -161,6 +166,9 @@ def _markdown_to_nodes(self, text, filename):
by Michael Droetboom.
"""
rst = ViewList()
renderer = RSTRenderer()
renderer.register("inline_math", _math_to_rst)
md2rst = mistune.create_markdown(renderer=renderer, plugins=["math"])
for i, line in enumerate(md2rst(text).split("\n")):
rst.append(line, filename, i + 1)

Expand Down
192 changes: 0 additions & 192 deletions sphinx_asdf/md2rst.py

This file was deleted.