Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
calbaker committed Jan 29, 2024
1 parent c2afb32 commit 2c32f57
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions python/fastsim/generate_doc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import fastsim as fsim
from pathlib import Path

from pydoc_markdown.interfaces import Context
from pydoc_markdown.contrib.loaders.python import PythonLoader
from pydoc_markdown.contrib.renderers.markdown import MarkdownRenderer

def main():
context = Context(directory=fsim.package_root())
loader = PythonLoader(
search_path=[fsim.package_root()],
ignore_when_discovered=["test", "tests", "setup", "demos"]
)
renderer = MarkdownRenderer(
# TODO: figure out what options in here will produce same result as
# `pydoc-markdown -I python --render-toc > docs/src/python-doc.md`
# # Commented args
# render_toc=True,
# render_toc_title=False,
# toc_maxdepth=1,
)

loader.init(context)
renderer.init(context)

modules = loader.load()

with open(fsim.package_root() / "../../docs/src/python-doc.md", "w") as f:
f.write(renderer.render_to_string(modules))

0 comments on commit 2c32f57

Please sign in to comment.