Asciidoctor Embeddable Styles

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Asciidoctor Embeddable Styles

devunwired

I have been playing around with building a "bare" HTML output in Asciidoctor using the -s flag, so that we can embed Asciidoc output into our existing CMS tool for displaying article posts on our site:

$ asciidoctor -s source.asc

I have two questions related to this that would help me simplify the process:

1. Is there a way (similar to -s) to JUST output the styles, or better yet output the <style> tags and the current "-s" output at the same time? Right now I have to cut the styles out of the full output and paste them into the CMS along with the "bare" HTML.

2. We have played around with doing the text styles using top-level CSS on the site, but would like (at a minimum) to bundle the Pygments syntax highlighter styles with the HTML doc output. Any ideas if this is achievable without cut/paste?

Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor Embeddable Styles

mojavelinux
Administrator
David,

I have good news for you. Asciidoctor exposes an API for accessing all the stylesheets it generates.

```
require 'asciidoctor'
stylesheets = Asciidoctor::Stylesheets.instance
```

Here's how to get the default stylesheet:

```
puts stylesheets.primary_stylesheet_data
```

or you can tell it to write it to a directory:

```
stylesheets.write_primary_stylesheet 'path/to/styles'
```

Replace "primary" with "coderay" or "pygments" to get the other stylesheets. For pygments, you can also specify the name of the style as the last argument:

```
stylesheets.write_pygments_stylesheet 'path/to/styles', 'pastie'
```


> 1. Is there a way (similar to -s) to JUST output the styles, or better yet output the <style> tags and the current "-s" output at the same time?

Nope. I'd just recommend writing a script that uses the API.

Cheers,

-Dan

On Mon, Jan 4, 2016 at 7:59 PM, devunwired [via Asciidoctor :: Discussion] <[hidden email]> wrote:

I have been playing around with building a "bare" HTML output in Asciidoctor using the -s flag, so that we can embed Asciidoc output into our existing CMS tool for displaying article posts on our site:

$ asciidoctor -s source.asc

I have two questions related to this that would help me simplify the process:

1. Is there a way (similar to -s) to JUST output the styles, or better yet output the <style> tags and the current "-s" output at the same time? Right now I have to cut the styles out of the full output and paste them into the CMS along with the "bare" HTML.

2. We have played around with doing the text styles using top-level CSS on the site, but would like (at a minimum) to bundle the Pygments syntax highlighter styles with the HTML doc output. Any ideas if this is achievable without cut/paste?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Asciidoctor-Embeddable-Styles-tp4144.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML




--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen