Skip to content

Commit

Permalink
Merge pull request #238 from stakater/task/use-mkdocs-in-git-submodul…
Browse files Browse the repository at this point in the history
…e-saap-docs-sa-5308

[Task] Use mkdocs in git submodule saap docs SA 5308
  • Loading branch information
tanalam2411 authored May 21, 2024
2 parents a313ae7 + 6423c2d commit 848d7df
Show file tree
Hide file tree
Showing 14 changed files with 715 additions and 360 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "theme_common"]
path = theme_common
url = [email protected]:stakater/stakater-docs-mkdocs-theme.git
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.12 as builder

RUN pip3 install mkdocs-material mkdocs-mermaid2-plugin mkdocs-table-reader-plugin mkdocs-include-markdown-plugin
RUN pip3 install mkdocs-mermaid2-plugin mkdocs-table-reader-plugin mkdocs-include-markdown-plugin

# set workdir
RUN mkdir -p $HOME/application
Expand All @@ -10,10 +10,10 @@ WORKDIR $HOME/application
COPY --chown=1001:root . .

# build the docs
RUN chmod +x prepare_theme.sh && ./prepare_theme.sh
RUN mkdocs build

FROM nginxinc/nginx-unprivileged:1.26-alpine as deploy
COPY --from=builder $HOME/application/site/ /usr/share/nginx/html/saap/
COPY --from=builder $HOME/application/site/ /usr/share/nginx/html/
COPY default.conf /etc/nginx/conf.d/

# set non-root user
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ Install mkdocs-material and mermaid plugin:
$ pip3 install mkdocs-material mkdocs-mermaid2-plugin
```

Finally serve the docs using the built-in web server which is based on Python http server - note that the production build will use Nginx instead:
Install mkdocs-include-markdown-plugin (if not installed by default and gives an error):

```bash
$ pip install mkdocs-include-markdown-plugin
```

Finally, serve the docs using the built-in web server which is based on Python http server - note that the production build will use Nginx instead:

```bash
$ mkdocs serve
Expand Down Expand Up @@ -77,3 +83,11 @@ Install [Tilt](https://docs.tilt.dev/index.html), then run:
```bash
$ tilt up
```

Files `main.html` and `404.html` are served from `theme_common` rather than override since they are to be consistent throughout. If anything changes they can be served via `theme_override`.

To execute the prepare theme command after setup you need to add the `prepare_theme.sh` or copy and paste bash file using sudo cmd file to your root directory and then run the following cmd:

```bash
$ chmod +x preparetheme sh
```
6 changes: 0 additions & 6 deletions custom_theme/404.html

This file was deleted.

5 changes: 0 additions & 5 deletions custom_theme/main.html

This file was deleted.

703 changes: 358 additions & 345 deletions mkdocs.yml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions prepare_theme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pip install -r theme_common/requirements.txt
python theme_common/scripts/combine_theme_resources.py theme_common/resources theme_override/resources dist/_theme
python theme_common/scripts/combine_mkdocs_config_yaml.py theme_common/mkdocs.yml theme_override/mkdocs.yml mkdocs.yml
1 change: 1 addition & 0 deletions theme_common
Submodule theme_common added at a17e7e
332 changes: 332 additions & 0 deletions theme_override/mkdocs.yml

Large diffs are not rendered by default.

File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added theme_override/resources/assets/images/logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 848d7df

Please sign in to comment.