当前位置 : 主页 > 网页制作 > css >

Asciidoctor render_file缺少CSS

来源:互联网 收集:自由互联 发布时间:2021-06-13
从CLI运行AsciiDoctor会创建一个带有嵌入式样式表的 HTML文档: $asciidoctor mysample.adoc....titleMy First Experience with the Dangers of Documentation/titlestyle/* Asciidoctor default stylesheet | MIT License | http://asci
从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">
...

documentation并不表示应该有任何差异.我错过了什么?

细节:

> Asciidoctor 0.1.4
> ruby​​ 2.0.0p247

要嵌入样式表,您必须以“不安全”模式呈现文件:

require 'asciidoctor'
Asciidoctor.render_file('mysample.adoc', :in_place => true, :safe => 'unsafe')
网友评论