This is a global warnning message

Sphinx Typlog Theme

Note

A sphinx theme sponsored by Typlog. Designed by Hsiaoming Yang.

Introduction

Design

This sphinx theme is designed based on the looks and feels on Typlog heavily.

Typlog is a blogging service. If you have interests in blogging, take a look into it.

License

This project is licensed under BSD 3.

Copyright (c) 2018, Hsiaoming Yang

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the creator nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

How To Use

Guide on how to use sphinx typlog theme.

Installation

Installing sphinx typlog theme is easy with pip:

$ pip install sphinx-typlog-theme

You can also add sphinx-typlog-theme into your requirements.txt.

How to Use

To use sphinx typlog theme in your documentation, configure it in conf.py:

html_theme = 'sphinx_typlog_theme'

If you are using Sphinx < 1.7, you can add it into html_theme_path:

import sphinx_typlog_theme
html_theme_path = [sphinx_typlog_theme.get_path()]

Other Options

In conf.py, there are lots of Options to be configured.

Options

There are some options for you to configure the theme in conf.py:

html_theme_options = {}

logo_name

You can hide the name under your logo image with:

html_theme_options = {
    'logo_name': 'false'
}

description

Add a description under your logo and logo_name:

html_theme_options = {
    'description': 'Your project description'
}

color

Add a theme color, it will be shown as the hover color for links etc:

html_theme_options = {
    'color': '#E8371A'
}

github

Configure your GitHub repo with github_user and github_repo:

html_theme_options = {
    'github_user': 'lepture',
    'github_repo': 'mistune'
}

Remember to include the github.html template:

html_sidebars = {
    '**': [
        'github.html',
        ...
    ]
}

analytics_id

Track your site with Google Analytics:

html_theme_options = {
    'analytics_id': 'UA-xxx'
}

Markup Styles

This page is showing markup styles, they have no meanings.

Admonition

Debug Note

The default admonition has no colors. It is gray.

Attention

Attention please!

Caution

Attention please!

Danger

This is a danger area.

Error

This is an error message.

Hint

This is hint message.

Important

This is an impoartant message.

Note

This page is showing markup styles, they have no meanings.

Oh. Except this message.

Tip

A small tip please.

Warning

Please don’t do anything harmful to me.

Sphinx Admonition

New in version 2.5: The spam parameter.

Changed in version 2.5: The spam parameter.

Deprecated since version 3.1: Use spam() instead.

See also

It is also available at https://typlog.com/

LICENSE AGREEMENT

  • A list of
  • short items
  • that should be
  • displayed
  • horizontally

Block Level

Code

Here is an example on code highlight:

@app.route('/', methods=['GET')
def hello(name='world'):
    return 'Hello {}'.format(name)

class API(object):
    """API docstring style"""

    def __init__(self, request):
        # comment
        self.request = request

Using code-block with other options.

test.js
function test() {
  console.log('hi');
}
1
2
3
fn main() {
    println!("Hello World!");
}

Quote

Here is an example on block quote:

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one– and preferably only one –obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea – let’s do more of those!

List

  • Make a list, and its items
    1. Ordered item: foo
      1. A third level item
    2. Ordered item: bar
  • The second item has no items
  • The third item has unordered items
    • A foo is a foo
    • A bar is a bar

Options Lists

-a command-line option “a”
-b file options can have arguments and long descriptions
--long options can be long also
--input=file long options can also have arguments
/V DOS/VMS-style options too

Inline Style

A plain text mixed with bold and italic. And we have code too.

Let’s try a link https://lepture.com.

Footnotes

Plain text Typical result Footnote references, like [5]. Note that footnotes may get rearranged, e.g., to the bottom of the “page”.

Autonumbered footnotes are possible, like using [1] and [2].

They may be assigned ‘autonumber labels’ - for instance, [4] and [3].

[5]A numerical footnote. Note there’s no colon after the ].
[1]This is the first one.
[2]This is the second one.
[3]a.k.a. third
[4]a.k.a. fourth

Citations

Citation references, like [CIT2002]. Note that citations may get rearranged, e.g., to the bottom of the “page”.

[CIT2002]A citation (as often used in journals).

Badges

Let’s have a preview of what badges look like:

  • done Add badge role
  • todo Add more badge features
  • doing Things that in plan
  • remove Some feature has been removed

GitHub

API References

sphinx_typlog_theme.get_path()

Shortcut for users to access this theme. If you are using Sphinx < 1.7, you can add it into html_theme_path:

import sphinx_typlog_theme
html_theme_path = [sphinx_typlog_theme.get_path()]
Returns:theme path
sphinx_typlog_theme.add_github_roles(app, repo)

Add gh role to your sphinx documents. It can generate GitHub links easily:

:gh:`issue#57` will generate the issue link
:gh:`PR#85` will generate the pull request link

Use this function in conf.py to enable this feature:

def setup(app):
    sphinx_typlog_theme.add_github_roles(app, 'lepture/authlib')
Parameters:
  • app – sphinx app
  • repo – GitHub repo, e.g. “lepture/authlib”
sphinx_typlog_theme.add_badge_roles(app)

Add badge role to your sphinx documents. It can create a colorful badge inline.

Contributing

Create and activate a new virtual environment, then run the following commands in the project root:

make install

To run the development server:

make serve

Then open http://127.0.0.1:5234 in your browser.

Changelog

Here is the changelog for sphinx typlog theme.

Version 0.7.3

Released on Jun 30, 2019

  • Fix headerlink style

Version 0.7.2

Released on Feb 13, 2019

  • Fix search scripts.

Version 0.7.1

Released on Jan 4, 2019

  • Fix RTD widget on mobile.
  • Fix sponsor image blocked by uBlock.

Version 0.7

Released on Dec 28, 2018

  • Style for global TOC.
  • Style for API references.
  • Use logo.html in sidebar.
  • Improvements on CSS.

Version 0.6.1

Released on Nov 6, 2018

Style for RTD injected widget.

Version 0.6

Released on Nov 6, 2018

New design.