使用 API 设置安全模式

通过 API 使用 Asciidoctor 时,默认的 安全模式SECURE。您可以使用 :safe API 选项来更改安全模式。

设置 :safe 选项

可以通过 API 使用 :safe 选项来控制安全模式。:safe 选项被所有 入口点方法(例如 Asciidoctor#convert_file)接受。

:safe 选项接受安全模式作为字符串

Asciidoctor.convert_file 'doc.adoc', safe: 'server'

作为符号(推荐)

Asciidoctor.convert_file 'doc.adoc', safe: :server

作为整数

Asciidoctor.convert_file 'doc.adoc', safe: 10