diff --git a/README.md b/README.md index 1d979e0..9ae4ef4 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ For an example of a website built with zona, please see - [Markdown Footer](#markdown-footer) - [Internal Link Resolution](#internal-link-resolution) - [Syntax Highlighting](#syntax-highlighting) + - [Markdown Extensions](#markdown-extensions) - [Image Labels](#image-labels) - [Frontmatter](#frontmatter) - [Post List](#post-list) @@ -125,9 +126,12 @@ support from the browser — this is why the feature is optional. To start a preview server, use `zona serve`. You can specify the root directory as its first argument. Use the `--host` to specify a host name (`localhost` by default) and `--port/-p` to specify a port (default: -`8000`). The `--output/-o` and `--draft/-d` options from `zona build` are -also supported. Finally, the `--no-live-reload/-n` disables the live -browser reloading. _Automatic site rebuilds are not disabled._ +`8000`). The `--no-live-reload/-n` disables the live browser reloading +(_automatic site rebuilds are not disabled_). + +Drafts are enabled by default in live preview. Use `--final/-f` to disable +them. By default, the build outputs to a temporary directory. Use +`-o/--output` to override this. **Note**: if the live preview isn't working as expected, try restarting the server. If you change the configuration or any templates, the server diff --git a/src/zona/cli.py b/src/zona/cli.py index f6f40af..1d32c4c 100644 --- a/src/zona/cli.py +++ b/src/zona/cli.py @@ -91,9 +91,9 @@ def serve( help="Location to write built website. Temporary directory by default.", ), ] = None, - draft: Annotated[ + final: Annotated[ bool, - typer.Option("--draft", "-d", help="Include drafts."), + typer.Option("--final", "-f", help="Don't include drafts."), ] = False, no_live_reload: Annotated[ bool, @@ -111,12 +111,14 @@ def serve( Optionally specify the ROOT and OUTPUT directories. """ - if draft: - print("Option override: including drafts.") + if final: + print("Preview without drafts.") + else: + print("Preview with drafts.") server.serve( root=root, output=output, - draft=draft, + draft=not final, host=host, port=port, live_reload=not no_live_reload, diff --git a/src/zona/server.py b/src/zona/server.py index c18f3a8..fa0c033 100644 --- a/src/zona/server.py +++ b/src/zona/server.py @@ -168,7 +168,7 @@ class ZonaReloadHandler(FileSystemEventHandler): def serve( root: Path | None = None, output: Path | None = None, - draft: bool = False, + draft: bool = True, host: str = "localhost", port: int = 8000, live_reload: bool = True,