Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate documentation to MkDocs #228

Closed
wants to merge 72 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
9d6bb36
Delegate Documentation builds to MkDocs, keep the rest as is
oleg-nenashev Nov 20, 2023
1ada9d1
Restore images also included in the docs
oleg-nenashev Nov 20, 2023
cce3fc3
Add code tabs
oleg-nenashev Nov 20, 2023
286a811
Migrate code tabs to the native MkDocs engine
oleg-nenashev Nov 20, 2023
94e4b6a
Workaround missing navigation entries
oleg-nenashev Nov 20, 2023
737f40a
Add WireMock.css
oleg-nenashev Nov 20, 2023
b6e814c
Update contributing info for MkDocs
oleg-nenashev Nov 20, 2023
37abf29
Ignore docs site contents
oleg-nenashev Nov 20, 2023
475af8d
Use top tabs for navigation
oleg-nenashev Nov 21, 2023
209141f
Migrate redirects to MkDocs and Jekyll outward redirects
oleg-nenashev Nov 21, 2023
6e825bb
More redirect link fixes
oleg-nenashev Nov 21, 2023
1e72a56
Use classic markdown referencing in cross-links
oleg-nenashev Nov 21, 2023
c31db8f
Add MkDocs build to CI
oleg-nenashev Nov 21, 2023
94087eb
Fix the requirements file
oleg-nenashev Nov 21, 2023
97b05aa
Add staging deployment pipeline
oleg-nenashev Nov 21, 2023
a043c47
Fix the branch name
oleg-nenashev Nov 21, 2023
bd609ce
Rename deployment pipelines
oleg-nenashev Nov 21, 2023
fbe2b29
Use MkDocs to generate 3.x docs
oleg-nenashev Nov 21, 2023
a09704d
Serve the documentation landing from Jekyll (for now)
oleg-nenashev Nov 21, 2023
e253adf
Fix the deployment pipeline
oleg-nenashev Nov 21, 2023
cb20fb4
Fix the API Templates nav bar
oleg-nenashev Nov 21, 2023
2fa57da
Fix the SpringBoot links
oleg-nenashev Nov 21, 2023
cc995d2
Add the "Go to WM Cloud" button
oleg-nenashev Nov 27, 2023
080ba94
Render OpenAPI specification from the external repo, remove obsolete …
oleg-nenashev Nov 27, 2023
314bf30
Add dependency to the requirement
oleg-nenashev Nov 27, 2023
2240956
Add code edit to the main docs
oleg-nenashev Nov 27, 2023
be53fa0
Add permalinks and move TOC to the right panel
oleg-nenashev Nov 27, 2023
1b29845
Move external resources to Docs, Add community and resource headers
oleg-nenashev Nov 27, 2023
34c40c6
Fix relative links on the Docker page
oleg-nenashev Nov 27, 2023
809c4c1
Fix rendering for the External Resources page
oleg-nenashev Nov 27, 2023
a090e54
HTML output for external resources is no longer used
oleg-nenashev Nov 27, 2023
0b54dcd
Cleanup external links documented on other pages
oleg-nenashev Nov 27, 2023
18d7620
Add generation of OpenGraphs for pages
oleg-nenashev Nov 27, 2023
6025388
Add Faker and OTel extensions to listing
oleg-nenashev Nov 27, 2023
10077d4
Fix deployment URL
oleg-nenashev Nov 27, 2023
6ef2adf
Introduce version macros
oleg-nenashev Nov 27, 2023
8581048
Fix the site URL
oleg-nenashev Nov 27, 2023
aa4eaf1
Update site URL
oleg-nenashev Nov 27, 2023
7613b94
Setup analytics
oleg-nenashev Nov 28, 2023
b8b2c5e
Fix image referencing on the website landing
oleg-nenashev Nov 28, 2023
3b80f0c
Adopt SCSS and prototype navbar
oleg-nenashev Nov 28, 2023
f3ffec3
Prettify the layout
oleg-nenashev Nov 28, 2023
2af9811
Fix search that must be in the header to work
oleg-nenashev Nov 28, 2023
ad25a66
Position repo info properly
oleg-nenashev Nov 28, 2023
c018034
Fix the landing look & Feel
oleg-nenashev Nov 28, 2023
5851c1d
Move Events info to the community repo
oleg-nenashev Nov 28, 2023
a0a3918
Fix Breakpoint submodule path
oleg-nenashev Nov 28, 2023
c5bc30b
Restore missing images
oleg-nenashev Nov 28, 2023
b2c4c0f
Fix navigation bar in Jekyll, add protocols summary page
oleg-nenashev Nov 28, 2023
307a45e
Add link to the extensions
oleg-nenashev Nov 28, 2023
9fcfe90
Fix rendering of Macros
oleg-nenashev Nov 28, 2023
aad0c44
Note performance issues when developing MkDocs
oleg-nenashev Nov 30, 2023
488c525
Introduce the community Slack page
oleg-nenashev Nov 30, 2023
733adb7
Use site_url in the navbar
oleg-nenashev Nov 30, 2023
f95bd78
Move community and commercial support pages to MkDocs
oleg-nenashev Nov 30, 2023
39c9824
More fixes in the navigation menu
oleg-nenashev Nov 30, 2023
53a3934
Remove the swagger specification dup, stop building redoc
oleg-nenashev Nov 30, 2023
5b49310
Move docs sidebar codebase
oleg-nenashev Nov 30, 2023
d39ed20
Restore missing resources in the navbar
oleg-nenashev Nov 30, 2023
fdc4a14
Fix docs layout images on the staging site
oleg-nenashev Nov 30, 2023
fbc4a7f
Replace title metadata on all pages
oleg-nenashev Nov 30, 2023
be4138f
Clean up the documentation landing metadata
oleg-nenashev Nov 30, 2023
1da35e8
Document using submodules for the site
oleg-nenashev Nov 30, 2023
67bb738
Restore burger menu and search in the mobile layout
oleg-nenashev Dec 10, 2023
01f31ab
Fix rendering on wide screen for burger menu and WMC button
oleg-nenashev Dec 10, 2023
e4a36da
More header alignment
oleg-nenashev Dec 10, 2023
11bcd69
Include documentation sitemap into the bundle
oleg-nenashev Dec 10, 2023
8758787
Add fancy rendering of the documentation root on the website
oleg-nenashev Dec 10, 2023
23d88cc
Add navigation section for Solution pages
oleg-nenashev Dec 10, 2023
045e7e7
Restructure the JVM solutions page
oleg-nenashev Dec 10, 2023
5428323
Merge branch 'main' of https://github.com/wiremock/wiremock.org into …
oleg-nenashev Dec 10, 2023
06df9cb
actions: Directory for Docs now needs to be created
oleg-nenashev Dec 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
blank_issues_enabled: true
contact_links:
- name: '🛟 Help on Slack'
url: https://slack.wiremock.org/
url: https://wiremock.org/docs/community/slack
about: |
You can ask questions on the community Slack in the '#help' or '#help-contributing' channels.
Please do not raise GitHub issues for questions.
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ jobs:
run: bundle exec jekyll build --config '_config.yml' --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: development

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1

- name: Install dependencies
run: pip install -r requirements.txt

- name: Build the docs
run: mkdocs build

- name: Build 2.x with Jekyll
# Outputs to the './_site' directory by default
run: |
Expand All @@ -52,6 +69,7 @@ jobs:
# with:
# directory: ./_site
# enforce_https: false
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v1

# - name: Upload artifact
# # Automatically uploads an artifact from the './_site' directory by default
# uses: actions/upload-pages-artifact@v1
111 changes: 111 additions & 0 deletions .github/workflows/deploy-mkdocs-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Deploy Preview to GitHub Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main", "mkdocs"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "true"
- name: Setup Ruby
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
with:
ruby-version: '2.7.6' # Not needed with a .ruby-version file
bundler: '2.4.10'
bundler-cache: false # runs 'bundle install' and caches installed gems automatically
cache-version: 3 # Increment this number if you need to re-download cached gems
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Update RubyGems and Co
run: gem update --system
- name: Install Ruby Bundles
run: bundle install

- name: Build with Jekyll
# Outputs to the './_site' directory by default
run: bundle exec jekyll build --config '_config.yml,_config-oleg-nenashev.yml' --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1

- name: Install dependencies
run: pip install -r requirements.txt

- name: Build the docs site
run: mkdocs build

- name: Build 2.x with Jekyll
# Outputs to the './_site' directory by default
run: |
cd .submodules/wiremock.org-2.x
bundle exec jekyll build --config '../../_config.yml,../../_config-2.x.yml,../../_config-oleg-nenashev-2.x.yml' --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
#- name: Build 3.x with Jekyll
# We use the same as the root build, but with additional config
# run: |
# bundle exec jekyll build --config '_config.yml,_config-3.x.yml,_config-oleg-nenashev-3.x.yml' --baseurl "${{ steps.pages.outputs.base_path }}"
# env:
# JEKYLL_ENV: production
- name: Deploy version branches to the website
run: |
ruby .scripts/merge-sitemaps.rb
mkdir _site/2.x
cp -R .submodules/wiremock.org-2.x/tmp/site_2x/* _site/2.x/
mkdir -p _site/docs
cp -R _site-docs/* _site/docs/
mkdir -p _site/3.x/docs
cp -R _site-docs/* _site/3.x/docs/
# TODO: Uncomment when cleaned up (if ever)
# - name: Validate HTML and links
# uses: anishathalye/proof-html@v2
# with:
# directory: ./_site
# enforce_https: false
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v1

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Jekyll site to Pages
name: Deploy to GitHub Pages

on:
# Runs on pushes targeting the default branch
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ main.css
/tmp

**/.DS_Store

# MkDocs
/temp_dir/
/_site-docs/
.cache
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
path = .submodules/wiremock.org-2.x
url = https://github.com/wiremock/wiremock.org.git
branch = 2.x
[submodule "extra_sass/vendor/breakpoint"]
path = extra_sass/vendor/breakpoint
url = https://github.com/at-import/breakpoint.git
branch = main
12 changes: 6 additions & 6 deletions .scripts/merge-sitemaps.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Merges sitemaps, to be called from the root directory
header, footer, content_main, content_2x, content_3x = []
header, footer, content_main, content_2x, content_docs = []

File.open( "_site/sitemap.xml", 'r' ) do |f1|
content_main = (IO.readlines f1)
Expand All @@ -13,14 +13,14 @@
content_2x.slice!( -1 )
end

File.open( "./tmp/site_3x/sitemap.xml", 'r' ) do |f3|
content_3x = (IO.readlines f3)
content_3x.slice!( 0..11 )
content_3x.slice!( -1 )
File.open( "./_site-docs/sitemap.xml", 'r' ) do |f3|
content_docs = (IO.readlines f3)
content_docs.slice!( 0..11 )
content_docs.slice!( -1 )
end

File.open( "_site/sitemap.xml", 'w' ) do |f4|
f4.write ( header + content_main + content_2x + content_3x + footer ).join()
f4.write ( header + content_main + content_docs + content_2x + footer ).join()
end


Expand Down
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"search.exclude": {
"**/wiremock.org-2.x/**": true
}
}
60 changes: 45 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to the WireMock website

[![a](https://img.shields.io/badge/slack-Join%20us-brightgreen?style=flat&logo=slack)](https://slack.wiremock.org/)
[![a](https://img.shields.io/badge/slack-Join%20us-brightgreen?style=flat&logo=slack)](https://wiremock.org/docs/community/slack)

All contributions to the website are welcome!
Whether you develop new documentation, want to share your use-case,
Expand Down Expand Up @@ -32,21 +32,55 @@ that is included as a submodule and build by the CD flow.
To update the documentation, submit pull requests against the branch,
and they will be included into the main release line.

## Editing
## Documentation

The documentation is built using
[MkDocs](https://www.mkdocs.org/),
[mkdocs-multirepo-plugin](https://github.com/jdoiro3/mkdocs-multirepo-plugin/tree/main) and
[Material for MkDocs](https://squidfunk.github.io/mkdocs-material)

### Building

The documentation website uses some sources from submodules,
so make sure to pull them before building the site.

Requirements:

- Python and PiP, recent versions
- Submodules are pulled in your local git clone

```shell
pip install -r requirements.txt
mkdocs build
```

### Local development

To serve the site locally:

```shell
mkdocs serve
```

> **WARNING:** Note that the multi-repo site maybe quite slow during the
> first build and then during the rebuilds.
> You can disable it for local development just by commenting out the plugin section in `mkdocs.yml`
> The same goes to the SCSS compiler which cannot be disabled.
> There are [jdoiro3/mkdocs-multirepo-plugin #129](https://github.com/jdoiro3/mkdocs-multirepo-plugin/issues/129)
> and [orzih/mkdocs-extra-sass-plugin #6](https://github.com/orzih/mkdocs-extra-sass-plugin/issues/6)
> submitted to improve the developer experience.

### Code Tabs

To reduce vertical space and provide examples by multiple technology stacks,
we added support for code tabs in the documentation.
It is a custom Jekyll plugin providing the `{% codetabs %}` macro in Markdown.
See the example here: https://wiremock.org/docs/stubbing/ .

Example:

```markdown
{% codetabs %}

{% codetab JSON %}
=== "JSON"

```json
{
Expand All @@ -64,9 +98,8 @@ Example:
}
```

{% endcodetab %}

{% codetab Java %}
=== "Java"

```java
@Test
Expand All @@ -77,16 +110,13 @@ Example:
}
```

{% endcodetab %}

{% endcodetabs %}
```


When editing the existing code, make sure to also copy-edit text around it to ensure consistency.
Example of a patch: [PR #165 - Code tabs in stubbing overview](https://github.com/wiremock/wiremock.org/pull/165).

## Preparing the developer environment
## Main site

### Preparing the developer environment

The website is powered by Jekyll, and hence the Ruby developer environment is needed.
It is recommended to use `Ruby 2.7.6` because of the known compatibility issues between recent Jekyll version and Ruby 3.
Expand All @@ -98,7 +128,7 @@ Prerequisites:
- Ruby 2.7.6
- Bundler 2.4.10

## Building the website
### Building the website

```bash
# Install the dependencies including Jekyll
Expand All @@ -110,7 +140,7 @@ bundle exec jekyll build --config '_config.yml'

Note that `_config_preview.yml' is used to disable analytics in the deployed versions

## Running the website locally
### Running the website locally

You can run the website locally and get live preview of the changes
on the website and in the documentation contents.
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Repository that stores the WireMock website and documentation.
Powered by Jekyll and Markdown.
The website uses the [Minimal Mistakes Theme](https://mmistakes.github.io/minimal-mistakes/) for Jekyll.
The documentation is built using
[MkDocs](https://www.mkdocs.org/),
[mkdocs-multirepo-plugin](https://github.com/jdoiro3/mkdocs-multirepo-plugin/tree/main) and
[Material for MkDocs](https://squidfunk.github.io/mkdocs-material)

## Contributing

Expand Down
2 changes: 2 additions & 0 deletions _config-oleg-nenashev-2.x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
url: "https://oleg-nenashev.github.io/wiremock.org"
baseurl: "wiremock.org/2.x/"
2 changes: 2 additions & 0 deletions _config-oleg-nenashev-3.x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
url: "https://oleg-nenashev.github.io/"
baseurl: "wiremock.org/3.x"
21 changes: 21 additions & 0 deletions _config-oleg-nenashev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
url: "https://oleg-nenashev.github.io/"
baseurl: "wiremock.org/"

# Analytics
analytics:
google:
# gtag
id: "G-F923LHBYYT"

# MS Clarity
clarity:
enabled: true
vwo:
enabled: true

# TODO: Update plugin code to support more fancy navigation
breadcrumbs:
root:
hide: true
image: true
imagePath: /wiremock.org/images/logos/doc-sections/home.svg
5 changes: 4 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ author:
include:
- .htaccess
- _pages
- _redirects
exclude:
- vendor/
- "*.sublime-project"
Expand All @@ -130,6 +131,8 @@ exclude:
- tmp
# Served via symbolic links
- .submodules
# Delegated to MkDocs
- _docs
keep_files:
- .git
- .svn
Expand Down Expand Up @@ -241,7 +244,7 @@ pageEditPrefix: https://github.com/wiremock/wiremock.org/edit/main/
grpc_extension_version: 0.4.0

community_slack:
join_url: https://slack.wiremock.org/
join_url: /docs/community/slack

# Default link for wiremock signup button in header
# This can be overridden in pages using frontmatter start_link variable
Expand Down
Loading