https://discuss.asciidoctor.org/Inserting-toc-entries-from-hyperlinked-source-code-tp668p698.html
Dave,
Aha! There's a very important piece of information you need to know, which we'll be sure to call attention to in the user guide. When you switch from the CLI (asciidoctor) to the API, the default safe mode switches from the lowest (unsafe) to the highest (secure). We kept the CLI consistent with AsciiDoc Python, but the API default had to change to accommodate requirements for GitHub deployment.
To restore all the missing functionality, add the following option to the Asciidoctor#render_file invocation:
:safe => :unsafe
or
:safe => :safe
That should solve #1, #2 and #3.
To help highlight this change, we'll definitely add the API equivalent of what a given command line invocation does. Good thinking!
The main (and really only) difference between the unsafe and safe modes is that in unsafe mode, Asciidoctor can include files from anywhere, whereas in safe mode it can only include files starting from the working directory.
Btw, in AsciiDoc, the attribute value empty string is the same as a true value. Internally, Asciidoctor only looks to see if the key is set in the case of a boolean attributes.
-Dan