从CLI运行AsciiDoctor将创建一个带有嵌入样式表的HTML文档:
$ asciidoctor mysample.adoc
....
<title>My First Experience with the Dangers of Documentation</title>
<style>
/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */
article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { display: block; }
...但是,在Ruby文件中运行Asciidoctor并不是:
r.rb:
#!/usr/bin/env ruby
require 'asciidoctor'
Asciidoctor.render_file('mysample.adoc', :in_place => true)
$ ./r.rb
...
<title>My First Experience with the Dangers of Documentation</title>
<link rel="stylesheet" href="./asciidoctor.css">
...文档并不表示应该有任何不同。我遗漏了什么?
详细信息:
发布于 2014-02-25 04:36:47
要嵌入样式表,必须以“不安全”模式呈现文件:
require 'asciidoctor'
Asciidoctor.render_file('mysample.adoc', :in_place => true, :safe => 'unsafe')发布于 2014-03-02 00:11:51
从技术上讲,您只需要将安全模式设置为:server或: set。只有:secure安全模式(使用API时的默认模式)才能强制启用linkcss属性。
我正在考虑在1.5.0中改变这一点。我不认为向完整文档添加样式在任何方面都是不安全的。此外,有很多方法可以覆盖这种行为,这样就不会丢失任何东西,但是可用性肯定是可以获得的。
https://stackoverflow.com/questions/22003468
复制相似问题