mirror of
https://github.com/zulip/zulip.git
synced 2025-10-30 19:43:47 +00:00
api docs: Replace most markdown files with a common template.
This PR adds a basic .md template that is followed by lot of /api pages. Since we have recently done the migration work to ensure that our REST API documentation pages for individual endpoints are almost all identical files following a common pattern, we can now get the payoff of deleting them all in favor of a shared template. This removes 2000 lines of somewhat finicky configuration from the codebase, and thus should save significant effort when documenting new API endpoints in the future. The markdown files for endpoints or other pages which deviate from the standard template remain, and the docs are instead generated from those files using the existing system.
This commit is contained in:
committed by
Tim Abbott
parent
15123bca68
commit
23b991a801
@@ -150,7 +150,6 @@ def render_markdown_path(
|
||||
md_engine.reset()
|
||||
|
||||
jinja = engines["Jinja2"]
|
||||
|
||||
try:
|
||||
# By default, we do both Jinja2 templating and Markdown
|
||||
# processing on the file, to make it easy to use both Jinja2
|
||||
@@ -169,6 +168,8 @@ def render_markdown_path(
|
||||
else:
|
||||
raise e
|
||||
|
||||
API_ENDPOINT_NAME = context.get("API_ENDPOINT_NAME", "")
|
||||
markdown_string = markdown_string.replace("API_ENDPOINT_NAME", API_ENDPOINT_NAME)
|
||||
html = md_engine.convert(markdown_string)
|
||||
rendered_html = jinja.from_string(html).render(context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user