Set the Safe Mode Using the API
When using Asciidoctor via the API, the default safe mode is SECURE
.
You can change the safe mode using the :safe
API option.
Set :safe option
The safe mode can be controlled from the API using the :safe
option.
The :safe
option is accepted by all entrypoint methods (e.g., Asciidoctor#convert_file
).
The :safe
option accepts the safe mode as a string:
Asciidoctor.convert_file 'doc.adoc', safe: 'server'
as a symbol (preferred):
Asciidoctor.convert_file 'doc.adoc', safe: :server
as an integer:
Asciidoctor.convert_file 'doc.adoc', safe: 10
You can also set the safe mode from the CLI and enable or disable content based on the current safe mode.