Skip to content

Commit 7a6c703

Browse files
authored
Merge pull request #6604 from cabalism/doc/local-preview
Add docs preview and build
2 parents 30c5115 + 9a34db5 commit 7a6c703

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ _release/
1313

1414
# MkDocs-related
1515
_site/
16+
.python-doc-virtualenv
1617

1718
# Haskell Language Server-related
1819
hie.yaml

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ directory of the repository. They are formatted in the
133133
[Markdown syntax](https://daringfireball.net/projects/markdown/), with some
134134
extensions.
135135

136+
The docs can be previewed locally with `make docs-serve` and can be built with
137+
`make _site/index.html`.
138+
136139
Those files are rendered on [haskellstack.org](http://haskellstack.org) by
137140
[Read the Docs](https://readthedocs.org/) using
138141
[MkDocs](https://www.mkdocs.org/) and the

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.PHONY: docs-serve
2+
docs-serve:
3+
$(MAKE) -C doc docs-serve
4+
5+
_site/index.html: doc/*.md
6+
$(MAKE) -C doc docs-build

doc/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
PYTHON_VIRTUALENV:=.python-doc-virtualenv
2+
MK_DOCS_CMD:=$(PYTHON_VIRTUALENV)/bin/mkdocs
3+
4+
../$(PYTHON_VIRTUALENV)/bin/activate:
5+
python3 -m venv ../$(PYTHON_VIRTUALENV)
6+
(. ../$(PYTHON_VIRTUALENV)/bin/activate && pip install -r requirements.txt)
7+
8+
docs-serve: ../$(PYTHON_VIRTUALENV)/bin/activate
9+
cd .. && $(MK_DOCS_CMD) serve
10+
11+
docs-build: ../$(PYTHON_VIRTUALENV)/bin/activate
12+
cd .. && $(MK_DOCS_CMD) build

0 commit comments

Comments
 (0)