Skip to main content

GreatDocs.preview()

Preview the documentation site locally.

Usage

Source

GreatDocs.preview(
    port=3000,
    *,
    open_path="",
    open_browser=True,
)

Starts a local HTTP server and opens the built site in the default browser. If the site hasn’t been built yet, it will be built first. Use great-docs build to rebuild the site if you’ve made changes.

Note

In practice, you would normally use the great-docs preview CLI command rather than calling this method directly. See the CLI reference for details.

Parameters

port: int = 3000

The port number for the local HTTP server (default 3000).

open_path: str = ""

A page to open instead of the home page, relative to the site, such as reference/index.html. If the page is missing, the home page opens instead.

open_browser: bool = True
Whether to open the page in the default browser.

Raises

OSError
If the site has no index.html after the build, or the server cannot listen on port.

Examples

Preview the documentation:

from great_docs import GreatDocs

docs = GreatDocs()
docs.preview()