Skip to content

Commit

Permalink
Preliminary work to make local debugging of jekyll work. (#1239)
Browse files Browse the repository at this point in the history
Running jekyll locally requires a Gemfile and null '---' header to convert .md files to .html (otherwise jekyll doesn't touch these files.) Also added google_analytics to _config.yml.  Both _layout/*.md files appear to support this already.

Resolves #1239

PiperOrigin-RevId: 457573545
  • Loading branch information
byoshimi-github authored and rchen152 committed Jun 27, 2022
1 parent bdd1556 commit f5640bf
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true
source "https://rubygems.org"

gem "webrick"
gem "github-pages", "~> 226", group: :jekyll_plugins
6 changes: 6 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
theme: jekyll-theme-minimal

google_analytics: G-G896Q7VERJ

defaults:
- scope:
path: ""
values:
layout: default
- scope:
path: developers
values:
Expand Down
2 changes: 2 additions & 0 deletions docs/_layouts/dev_guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ <h1><a href="{{ "/" | absolute_url }}">{{ site.title | default: site.github.repo
<a href="{{ "developers/style_guide.html" | relative_url }}">Style guide</a>
<br />
<a href="{{ "developers/tools.html" | relative_url }}">Tools</a>
<br />
<a href="{{ "developers/debug_docs.html" | relative_url }}">Debug documentation</a>
</p>

{% if site.github.is_project_page %}
Expand Down
53 changes: 53 additions & 0 deletions docs/developers/debug_docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# How to setup environment for previewing changes to documentation

<!--* freshness: { owner: 'rechen' reviewed: '2022-06-27' } *-->

The pytype documentation is in markdown format.

github uses [jekyll](https://jekyllrb.com/docs/) to render these pages.

## Prerequisites

Install/update ruby and bundler

```shell
ruby -v # should be greater than 3.0.0
```

If it doesn't exist or is too old

```shell
sudo apt-get install ruby-full
```

Add path to your .bashrc

```shell
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```

Install packages required for jekyll

```shell
gem install jekyll bundler webrick
gem update jekyll
bundle install
```

## Start jekyll locally

```shell
cd docs # you'll need to be in the pytype/docs directory

bundle exec jekyll serve --watch
```

The `--watch` flag forces jekyll to look for changes to your source files and
reload the server if it detects any changes.

You can view your webpages by navigating to
[http://localhost:4000](http://localhost:4000) like
[http://localhost:4000/developers/index.html](http://localhost:4000/developers/index.html)

0 comments on commit f5640bf

Please sign in to comment.