blob: 4d2480f7c72adf974e65e44a1e0f79b9dd9dedd5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
= Set the Safe Mode Using the API
:navtitle: Set Safe Mode
When using Asciidoctor via the API, the default xref:ROOT:safe-modes.adoc[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 xref:index.adoc#entrypoints[entrypoint methods] (e.g., `Asciidoctor#convert_file`).
The `:safe` option accepts the safe mode as a string:
[,ruby]
----
Asciidoctor.convert_file 'doc.adoc', safe: 'server'
----
as a symbol (preferred):
[,ruby]
----
Asciidoctor.convert_file 'doc.adoc', safe: :server
----
as an integer:
[,ruby]
----
Asciidoctor.convert_file 'doc.adoc', safe: 10
----
You can also set the xref:cli:set-safe-mode.adoc[safe mode from the CLI] and xref:ROOT:reference-safe-mode.adoc[enable or disable content based on the current safe mode].
|