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

Setup Mkdocs website for documentation #722

Merged
merged 6 commits into from Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 36 additions & 0 deletions .buildscript/deploy_website.sh
@@ -0,0 +1,36 @@
#!/bin/bash

# The website is built using MkDocs with the Material theme.
# https://squidfunk.github.io/mkdocs-material/
# It requires Python to run.
# Install the packages with the following command:
# pip install mkdocs mkdocs-material

set -ex

REPO="git@github.com:square/kotlinpoet.git"
DIR=temp-clone

# Delete any existing temporary website clone
rm -rf $DIR

# Clone the current repo into temp folder
git clone $REPO $DIR

# Move working directory into temp folder
cd $DIR

# Generate the API docs
./gradlew :kotlinpoet:dokka

# Copy in special files that GitHub wants in the project root.
cat README.md > docs/index.md
cp CHANGELOG.md docs/changelog.md
cp CONTRIBUTING.md docs/contributing.md

# Build the site and push the new files up to GitHub
mkdocs gh-deploy

# Delete our temp folder
cd ..
rm -rf $DIR
6 changes: 6 additions & 0 deletions .gitignore
Expand Up @@ -15,6 +15,12 @@ reports
*.iml
classes

# Mkdocs files
docs/1.x/*
docs/changelog.md
docs/contributing.md
docs/index.md

obj

.DS_Store
31 changes: 31 additions & 0 deletions docs/css/app.css
@@ -0,0 +1,31 @@
@font-face {
font-family: cash-market;
src: url("https://cash-f.squarecdn.com/static/fonts/cash-market/v2/CashMarket-Regular.woff2") format("woff2");
font-weight: 400;
font-style: normal
}

@font-face {
font-family: cash-market;
src: url("https://cash-f.squarecdn.com/static/fonts/cash-market/v2/CashMarket-Medium.woff2") format("woff2");
font-weight: 500;
font-style: normal
}

@font-face {
font-family: cash-market;
src: url("https://cash-f.squarecdn.com/static/fonts/cash-market/v2/CashMarket-Bold.woff2") format("woff2");
font-weight: 700;
font-style: normal
}

body, input {
font-family: cash-market,"Helvetica Neue",helvetica,sans-serif;
}

.md-typeset h1, .md-typeset h2, .md-typeset h3, .md-typeset h4 {
font-family: cash-market,"Helvetica Neue",helvetica,sans-serif;
line-height: normal;
font-weight: bold;
color: #353535;
}
Binary file added docs/images/icon-square.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion kotlinpoet/build.gradle.kts
Expand Up @@ -36,7 +36,8 @@ tasks.named<Jar>("jar") {
afterEvaluate {
tasks.named<DokkaTask>("dokka") {
skipDeprecated = true
outputFormat = "html"
outputDirectory = "$rootDir/docs/1.x"
outputFormat = "gfm"
}
}

Expand Down
49 changes: 49 additions & 0 deletions mkdocs.yml
@@ -0,0 +1,49 @@
# pip install mkdocs mkdocs-material
# mkdocs serve
# mkdocs gh-deploy

site_name: KotlinPoet
repo_name: KotlinPoet
repo_url: https://github.com/square/kotlinpoet
site_description: "A Kotlin API for generating .kt source files"
site_author: Square, Inc.
remote_branch: gh-pages

copyright: 'Copyright &copy; 2015 Square, Inc.'

theme:
name: 'material'
logo: 'images/icon-square.png'
favicon: 'images/icon-square.png'
palette:
primary: 'cyan'
accent: 'deep-purple'

extra_css:
- 'css/app.css'

markdown_extensions:
- smarty
- codehilite:
guess_lang: false
- footnotes
- meta
- toc:
permalink: true
- pymdownx.betterem:
smart_enable: all
- pymdownx.caret
- pymdownx.inlinehilite
- pymdownx.magiclink
- pymdownx.smartsymbols
- pymdownx.superfences
- pymdownx.emoji
- tables
- admonition

nav:
- 'Overview': index.md
- 'API': 1.x/kotlinpoet/com.squareup.kotlinpoet/index.md
- 'Stack Overflow ⏏': https://stackoverflow.com/questions/tagged/kotlinpoet?sort=active
- 'Change Log': changelog.md
- 'Contributing': contributing.md