Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolves asciidoctor/asciidoctor-documentation-planning#18 corrects c…
…opycss info - corrects copycss documentation in user manual, render, and theme docs - corrects linkcss documentation in user manual, render, and theme docs - corrects link reference between documentation - adds code and image examples for rendering and stylesheets - adds include files for each section of rendering a document - introduces the magical, mystical wolpertinger
- Loading branch information
1 parent
dbf72bd
commit ebdf314
Showing
21 changed files
with
440 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//// | ||
HTML output section | ||
|
||
=== CodeRay and Pygments stylesheets | ||
|
||
This document is included in render-documents and the user-manual. | ||
//// | ||
Asciidoctor will also embed the theme stylesheet for the CodeRay or Pygments syntax highlighter. | ||
.CodeRay | ||
If the +source-highlighter+ attribute is +coderay+ and the +coderay-css+ attribute is +class+, the CodeRay stylesheet is: | ||
* _embedded_ by default | ||
* _copied_ to the file [file]_asciidoctor-coderay.css_ inside the +stylesdir+ folder within the output directory if +linkcss+ is set | ||
.Pygments | ||
If the +source-highlighter+ attribute is +pygments+ and the +pygments-css+ attribute is +class+, the Pygments stylesheet is: | ||
* _embedded_ by default | ||
* _copied_ to the file [file]_asciidoctor-pygments.css_ inside the +stylesdir+ folder within the output directory if +linkcss+ is set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//// | ||
HTML output section | ||
|
||
== Using a command line tool | ||
|
||
This document is included in render-documents and the user-manual. | ||
//// | ||
In this section, we'll create a sample document, then process and render it with Asciidoctor's +html5+ backend. | ||
. Create an AsciiDoc file like the one below | ||
. Save the file as +mysample.adoc+ | ||
---- | ||
include::mysample.adoc[] | ||
---- | ||
To convert +mysample.adoc+ to HTML from the command line: | ||
. Open a console | ||
. Switch to the directory that contains the +mysample.adoc+ document | ||
. Call the Asciidoctor processor with the +asciidoctor+ command, followed by the name of the document you want to render | ||
//^ | ||
$> asciidoctor mysample.adoc | ||
Remember, Asciidoctor's default backend is +html5+, so it isn't necessary to specify it with the +-b+ command. | ||
You won't see any messages printed to the console. | ||
If you type +ls+ or view the directory in a file manager, there is a new file named +mysample.html+. | ||
$> ls | ||
mysample.adoc mysample.html | ||
Asciidoctor derives the name of the output document from the name of the input document. | ||
Open +mysample.html+ in your web browser. | ||
Your document should look like the image below. | ||
==== | ||
image::mysample.png[] | ||
==== | ||
The document's text, titles, and link is styled by the default Asciidoctor stylesheet, which is embedded in the HTML output. | ||
As a result, you could save +mysample.html+ to any computer and it will look the same. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//// | ||
HTML output section | ||
|
||
=== Managing images | ||
|
||
This document is included in render-documents and the user-manual. | ||
//// | ||
Images are not embedded in the HTML output by default. | ||
If you have image references in your document, you'll have to save the image files in the same directory as your rendered document. | ||
Or, by passing the +data-uri+ attribute to the processor, you can embed the images into the document. | ||
To embed images into the HTML output, set +data-uri+ on the command line or in the document's header. | ||
$> asciidoctor -a data-uri mysample.adoc | ||
---- | ||
include::mysample-data-uri.adoc[] | ||
---- | ||
==== | ||
image::mysample-data-uri.png[] | ||
==== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//// | ||
HTML output section | ||
|
||
== Using the Ruby API | ||
|
||
This document is included in render-documents and the user-manual. | ||
TODO: expand this section | ||
//// | ||
Asciidoctor also includes a Ruby API that lets you generate an HTML document directly from a Ruby application. | ||
[source,ruby] | ||
---- | ||
require 'asciidoctor' | ||
Asciidoctor.render_file('mysample.adoc', :in_place => true) | ||
---- | ||
Alternatively, you can capture the HTML output in a variable instead of writing it to a file. | ||
[source,ruby] | ||
---- | ||
html = Asciidoctor.render_file('mysample.adoc', :header_footer => true) | ||
puts html | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
//// | ||
HTML output section | ||
|
||
=== Styling the HTML with CSS | ||
|
||
This document is included in render-documents and the user-manual. | ||
//// | ||
Asciidoctor uses CSS for HTML document styling and JavaScript for generating document attributes such as a table of contents and footnotes. | ||
It comes bundled with a fresh, modern stylesheet, named +asciidoctor.css+. | ||
When you generate a document with the +html5+ backend, the +asciidoctor.css+ stylesheet is embedded into the HTML output by default. | ||
However, you can link to the stylesheet instead of embedding it. | ||
To have your document link to the default stylesheet, set the +linkcss+ attribute in the document's header. | ||
---- | ||
include::mysample-link.adoc[] | ||
---- | ||
You can also set +linkcss+ with the CLI. | ||
$> asciidoctor -a linkcss mysample.adoc | ||
Now, when you view the directory, you should see the file +asciidoctor.css+ in addition to +mysample.adoc+ and +mysample.html+. | ||
The +linkcss+ attribute automatically copies +asciidoctor.css+ to the output directory. | ||
Additionally, you can inspect +mysample.html+ in your browser and see +<link rel="stylesheet" href="./asciidoctor.css">+ inside the +<head>+ tags. | ||
==== | ||
image::mysample-link.png[] | ||
==== | ||
If you don't want any styles applied to the HTML output of your document, unset the +stylesheet+ attribute. | ||
$> asciidoctor -a stylesheet! mysample.adoc | ||
One of Asciidoctor's strengths is the ease in which you can swap the default stylesheet for your own custom stylesheet or alternative Asciidoctor themes. | ||
If you want to apply your own stylesheet to the rendered HTML, using the CLI: | ||
. Save your custom stylesheet in the same directory as +mysample.adoc+ | ||
. Call the +asciidoctor+ processor | ||
. Add the +stylesheet+ attribute with +-a+ (+--attribute+) | ||
. Include the stylesheet file's name | ||
//end | ||
$> asciidoctor -a stylesheet=mystyles.css mysample.adoc | ||
Alternatively, let's set the +stylesheet+ attribute in the header of +mysample.adoc+. | ||
---- | ||
include::mysample-stylesheet.adoc[] | ||
---- | ||
==== | ||
image::mysample-stylesheet.png[] | ||
==== | ||
Stylesheets can also be stored in a directory other than the directory where your document is saved; you just need to tell Asciidoctor where to look for them using the +stylesdir+ attribute. | ||
Let's store the +mystyles.css+ stylesheet in +mydocuments/mystylesheets/+. | ||
Our AsciiDoc document, +mysample.adoc+, is saved in the +mydocuments/+ directory. | ||
---- | ||
include::mysample-stylesdir.adoc[] | ||
---- | ||
When you process +mysample.adoc+, the HTML output (+mysample.html+) is saved in the +mydocuments/+ directory. | ||
==== | ||
image::mysample-stylesdir-dir.png[] | ||
==== | ||
You can also set +stylesdir+ in the CLI. | ||
$> asciidoctor -a stylesdir=mystylesheets/ -a stylesheet=mystyles.css mysample.adoc | ||
If you don't want to embed the +mystyles.css+ stylesheet into your HTML output, make sure to set +linkcss+. | ||
---- | ||
include::mysample-stylesdir-link.adoc[] | ||
---- | ||
After your document is rendered, notice that a copy of +mystyles.css+ was not created in the +mydocuments/+ directory. | ||
Unlike when you link to the default Asciidoctor stylesheet, any custom stylesheets you link to are not copied to the directory where your output is saved. | ||
CAUTION: The +copycss+ attribute, which would copy a custom stylesheet when a document is rendered, is broken. | ||
Watch https://github.com/asciidoctor/asciidoctor/issues/300[Issue #300] for updates. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
= My First Experience with the Dangers of Documentation | ||
:imagesdir: myimages | ||
:data-uri: | ||
|
||
In my world, we don't have to worry about mutant, script-injecting warlocks. | ||
No. | ||
We have something far worse. | ||
We're plagued by Wolpertingers. | ||
|
||
== Origins | ||
|
||
[.left.text-center] | ||
image::wolpertinger.jpg[Wolpertinger] | ||
|
||
You may not be familiar with these http://en.wikipedia.org/wiki/Wolpertinger[ravenous beasts], but, trust me, they'll eat your shorts and suck the loops from your code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
= My First Experience with the Dangers of Documentation | ||
:linkcss: | ||
|
||
In my world, we don't have to worry about mutant, script-injecting warlocks. | ||
No. | ||
We have something far worse. | ||
We're plagued by Wolpertingers. | ||
|
||
== Origins | ||
|
||
You may not be familiar with these http://en.wikipedia.org/wiki/Wolpertinger[ravenous beasts], but, trust me, they'll eat your shorts and suck the loops from your code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
= My First Experience with the Dangers of Documentation | ||
:stylesdir: mystylesheets/ | ||
:stylesheet: mystyles.css | ||
:linkcss: | ||
|
||
In my world, we don't have to worry about mutant, script-injecting warlocks. | ||
No. | ||
We have something far worse. | ||
We're plagued by Wolpertingers. | ||
|
||
== Origins | ||
|
||
You may not be familiar with these http://en.wikipedia.org/wiki/Wolpertinger[ravenous beasts], but, trust me, they'll eat your shorts and suck the loops from your code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
= My First Experience with the Dangers of Documentation | ||
:stylesdir: mystylesheets/ | ||
:stylesheet: mystyles.css | ||
|
||
In my world, we don't have to worry about mutant, script-injecting warlocks. | ||
No. | ||
We have something far worse. | ||
We're plagued by Wolpertingers. | ||
|
||
== Origins | ||
|
||
You may not be familiar with these http://en.wikipedia.org/wiki/Wolpertinger[ravenous beasts], but, trust me, they'll eat your shorts and suck the loops from your code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
= My First Experience with the Dangers of Documentation | ||
:stylesheet: mystyles.css | ||
|
||
In my world, we don't have to worry about mutant, script-injecting warlocks. | ||
No. | ||
We have something far worse. | ||
We're plagued by Wolpertingers. | ||
|
||
== Origins | ||
|
||
You may not be familiar with these http://en.wikipedia.org/wiki/Wolpertinger[ravenous beasts], but, trust me, they'll eat your shorts and suck the loops from your code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
= My First Experience with the Dangers of Documentation | ||
|
||
In my world, we don't have to worry about mutant, script-injecting warlocks. | ||
No. | ||
We have something far worse. | ||
We're plagued by Wolpertingers. | ||
|
||
== Origins | ||
|
||
You may not be familiar with these http://en.wikipedia.org/wiki/Wolpertinger[ravenous beasts], but, trust me, they'll eat your shorts and suck the loops from your code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.