Skip to content

Commit

Permalink
chore(docs-generator): Add gfm formatters. (#257)
Browse files Browse the repository at this point in the history
PR: #257
  • Loading branch information
OmarAlJarrah authored Oct 26, 2023
1 parent 5808de7 commit 9ce68f0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/generate-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ jobs:
cp "../generator/package/expediagroup/sdk/$namespace/model.py" "./temp/expediagroup/sdk/$namespace/model.py"
python3 ./__main__.py -p ./temp -n "$namespace"
- name: Install Pandoc
run: |
pip3 install lastversion
architecture="$(dpkg --print-architecture)"
lastversion --assets --filter "$architecture.deb" download https://github.com/jgm/pandoc
sudo dpkg -i "$(ls | grep 'pandoc-.*\.deb')"
- name: Format docs
working-directory: expediagroup/sdk/docsgen/docs
run: |
source ../env/bin/activate
npx prettier --write --parser markdown *.md
for file in *.md; do pandoc "$file" -f markdown -t gfm -o "${file%.md}.md"; done
mdformat .
- uses: actions/upload-artifact@v3
with:
name: sdk
Expand Down
4 changes: 2 additions & 2 deletions expediagroup/sdk/docsgen/templates/class.jinja2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ breadcrumbs }}
# class `{{ module.name }}.{{ class.name }}`
```
```python
{{ class.constructor.name }}({% for arg in class.constructor.arguments %}
{{ arg.name }}: {{ arg.datatype }},{% endfor %}
)
Expand Down Expand Up @@ -29,7 +29,7 @@
## Methods
{% for method in class.methods %}
### {{ method.name }}
```
```python
{{ method.name }}(
{% for arg in method.arguments %}{{ arg.name }}: {{ arg.datatype }},
{% endfor %})
Expand Down
5 changes: 5 additions & 0 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ typer
docstring_parser
jinja2
mdformat-gfm~=0.3.5
mdformat-frontmatter~=2.0.1
mdformat-footnote~=0.1.1
mdformat-black~=0.1.1
mdformat-tables~=0.4.1
mdformat_deflist~=0.1.2

0 comments on commit 9ce68f0

Please sign in to comment.