2023-12-10 08:08:50 +01:00
|
|
|
from sphinx.application import Sphinx
|
|
|
|
|
2023-12-09 23:11:43 +01:00
|
|
|
from .d2lang import D2langDirective
|
|
|
|
|
2023-12-10 08:09:52 +01:00
|
|
|
from typing import Any, Dict, List, Tuple
|
|
|
|
|
2023-12-10 21:35:56 +01:00
|
|
|
from shutil import which
|
2023-12-10 08:42:48 +01:00
|
|
|
|
2023-12-09 23:11:43 +01:00
|
|
|
def setup(application: Sphinx) -> Dict[str, Any]:
|
|
|
|
"""
|
|
|
|
setup extension.
|
|
|
|
"""
|
2023-12-10 08:42:48 +01:00
|
|
|
if which('d2'):
|
|
|
|
application.add_directive('d2lang', D2langDirective)
|
|
|
|
return {"version": '0.0.1', "parallel_read_safe": True}
|
|
|
|
else:
|
|
|
|
raise
|