Command line reference#
The html2blocks command is installed with collective.html2blocks, but it needs an extra to run.
Install collective.html2blocks[cli] for the convert and info commands.
Install collective.html2blocks[server] for the server command.
The all extra installs both sets.
Run html2blocks --help to list the commands.
Run html2blocks COMMAND --help to see the options of a command.
convert#
Convert an HTML or Markdown file to a JSON file with Volto blocks.
Usage: html2blocks convert [OPTIONS] SRC DST
Argument or option |
Description |
Default |
|---|---|---|
|
Path to the HTML or Markdown file to read. |
Required |
|
Path of the JSON file to write. Its parent folder must exist. |
Required |
|
Input format, |
Detected from the suffix of |
|
Enable a block type, such as |
The default state of each block type |
|
Disable a block type, such as |
The default state of each block type |
|
Set an option of a block type, such as |
The defaults of the block type |
The format is detected from the suffix of SRC.
Files with the .md or .markdown suffix are read as Markdown.
All other files are read as HTML.
If SRC does not exist, or if the parent folder of DST does not exist, the command prints a message and exits with status 1.
The block types, their default state and their options are listed in Supported blocks, and by the blocks command.
Boolean option values are true, false, yes, no, on, off, 1 or 0.
An unknown block type or option, a value of the wrong type, or a block type both enabled and disabled makes the command print a message and exit with status 2.
The output is JSON, written with an indentation of two spaces.
It has the blocks and blocks_layout keys.
blocks#
List the Volto block types the converters can produce. For each block type, the report gives the frontend package that provides it, its default state, what it's converted from, and its options with their defaults.
Usage: html2blocks blocks [OPTIONS]
Option |
Description |
Default |
|---|---|---|
|
Output format: |
|
The default state is on, off, or always for a block type that can't be disabled.
info#
Print the package name and version, followed by the block types with their package and default state, the block converters and the element converters that are registered.
Usage: html2blocks info
This command takes no options.
server#
Run the HTTP service with Uvicorn.
Usage: html2blocks server [OPTIONS]
Option |
Description |
Default |
|---|---|---|
|
Address to bind. |
|
|
Port to listen on. |
|
|
Restart the server when the source code changes. Use this option only during development. |
|
The endpoints of the service are described in the Web service reference.