Re:VIEW Format Guide
The document is a brief guide for Re:VIEW markup syntax.
Re:VIEW is based on EWB of ASCII (now KADOKAWA), influenced RD and other Wiki system's syntax.
This document explains about the format of Re:VIEW 5.1.
Paragraph
Paragraphs are separated by an empty line.
Usage:
Two empty lines or more are same as one empty line.
Chapter, Section, Subsection (headings)
Chapters, sections, subsections, subsubsections use =
, ==
, ===
, ====
, =====
, and ======
. You should add one or more spaces after =
.
Usage:
Headings should not have any spaces before title; if line head has space, it is as paragraph.
You should add emply lines between Paragraphs and Headings.
Column
[column]
in a heading are column's caption.
Usage:
=
and [column]
should be closed to. Any spaces are not permitted.
Columns are closed with next headings.
If you want to close column without headings, you can use ===[/column]
Usage:
There are some more options of headings.
[nonum]
: no numbering, but add it into TOC (Table of Contents).[nodisp]
: not display in document, only in TOC.[notoc]
: no numbering, not in TOC.
Itemize
Itemize (ul in HTML) uses *
(one space char and asterisk).
Nested itemize is like **
, ***
.
Usage:
In itemize, you must write one more space character at line head. When you use *
without spaces in line head, it's just paragraph.
You should add emply lines between Paragraphs and Itemize (same as Ordered and Non-Orderd).
Ordered Itemize
Ordered itemize (ol in HTML) uses 1. ...
, 2. ...
, 3. ...
. They aren't nested.
Usage:
The value of Number is ignored.
You must write one more space character at line head like itemize.
Definition List
Definition list (dl in HTML) uses :
and indented lines.
Usage:
:
in line head is not used as a text. The text after :
is as the term (dt in HTML).
In definition list, :
at line head allow space characters. After dt line, space-indented lines are descriptions(dd in HTML).
You can use inline markup in texts of lists.
Block Commands and Inline Commands
With the exception of headings and lists, Re:VIEW supports consistent syntax.
Block commands are used for multiple lines to add some actions (ex. decoration).
The syntax of block commands is below:
If there is no options, the begining line is just //command{
. When you want to use a character ]
, you must use escaping \]
.
Some block commands has no content.
Inline commands are used in block, paragraphes, headings, block contents and block options.
When you want to use a character }
in inline content, you must use escaping \}
. If the content ends with \
, it must be written \\
. (ex. @<tt>{\\}
)
There are some limitations in blocks and inlines.
Block commands do not support nestins. You cannot write blocks in another block.
You cannot write headings and itemize in block contents.
Inline commands also do not support nestins. You cannot write inlines in another inline.
Fence notation for inline commands
You may be tired of escaping when you use a large number of inline commands including {
and \
. By surrounding the contents with $ $
or | |
instead of { }
, you can write without escaping.
Example:
Since this notation is substitute, please avoid abuse.
Code List
Code list like source codes is //list
. If you don't need numbers, you can use em
prefix (as embedded). If you need line numbers, you can use num
postfix. So you can use four types of lists.
//list[ID][caption][language]{ ... //}
normal list. language is optional.
//listnum[ID][caption][language]{ ... //}
normal list with line numbers. language is optional.
//emlist[caption][language]{ ... //}
list without caption counters. caption and language are optional.
//emlistnum[caption][language]{ ... //}
list with line numbers without caption counters. caption and language are optional.
Usage:
Usage:
Usage:
Usage:
The Language option is used for highlightings.
You can use inline markup in blocks.
When you refer a list like see list X
, you can use an ID in //list
such as @<list>{main}
.
When you refer a list in the other chapter, you can use an ID with chapter ID, such like @<list>{advanced|main}
, to refer a list main
in advanced.re
.
define line number of first line in code block
If you want to start with specified number as line number, you can use firstlinenum
command.
Usage:
Quoting Source Code
//source
is for quoting source code. filename is mandatory.
Usage:
//source
and //emlist
with caption is not so different. You can use them with different style with CSS (in HTML) and style file (in LaTeX).
//source
can be referred same as the list.
Usage:
Inline Source Code
You can use @<code>{...}
in inline context.
Usage:
Shell Session
When you want to show command line operation, you can use //cmd{ ... //}
. You can use inline commands in this command.
Usage:
You can use inline markup in //cmd
blocks.
Figure
You can use //image{ ... //}
for figures. You can write comments or Ascii art in the block as an alternative description. When publishing, it's simply ignored.
Usage:
The third option is used to define the scale of images. scale=X
is scaling for page width (scale=0.5
makes image width to be half of page width). If you'd like to use different values for each builders, such as HTML and TeX, you can specify the target builders using ::
. Example: html::style="transform: scale(0.5);",latex::scale=0.5
When you want to refer images such as "see figure 1.", you can use inline reference markup like @<img>{unixhistory}
.
When you refer a image in the other chapter, you can use the same way as a list reference. To refer a image unixhistory
in advanced.re
, use @<img>{advanced|unixhistory}
.
When you want to use images in paragraph or other inline context, you can use @<icon>
.
Finding image pathes
The order of finding image is as follows. The first matched one is used.
<imgdir>
isimages
as default.<builder>
is a builder (target) name to use. When you use review-comile commmand with--target=html
,<imagedir>/<builder>
isimages/html
. The builder name for epubmaker and webmaker ishtml
, for pdfmaker it islatex
, and for textmaker it istop
.<chapid>
is basename of *.re file. If the filename isch01.re
, chapid isch01
.<id>
is the ID of the first argument of//image
. You should use only printable ASCII characters as ID.<ext>
is file extensions of Re:VIEW. They are different by the builder you use.
For each builder, image files are searched in order of the following extensions, and the first hit file is adopted.
HTMLBuilder (EPUBMaker, WEBMaker), MARKDOWNBuilder: .png, .jpg, .jpeg, .gif, .svg
LATEXBuilder (PDFMaker): .ai, .eps, .pdf, .tif, .tiff, .png, .bmp, .jpg, .jpeg, .gif
Other builders/makers: .ai, .psd, .eps, .pdf, .tif, .tiff, .png, .bmp, .jpg, .jpeg, .gif, .svg
Inline Images
When you want to use images in paragraph, you can use the inline command @<icon>{ID}
. The order of finding images are same as //image
.
Images without caption counter
//indepimage[filename][caption]
makes images without caption counter. caption is optional.
Usage:
Note that there are similar markup //numberlessimage
, but it is deprecated.
Figures with graph tools
Re:VIEW generates image files using graph tool with command //graph[filename][commandname][caption]
. The caption is optional.
Usage: using with Gnuplot
You can use graphviz
, gnuplot
, blockdiag
, aafigure
, and plantuml
as the command name. Before using these tools, you should installed them and configured path appropriately.
Graphviz ( https://www.graphviz.org/ ) : set path to
dot
commandGnuplot ( http://www.gnuplot.info/ ) : set path to
gnuplot
commandBlockdiag ( http://blockdiag.com/ ) : set path to
blockdiag
command. Install ReportLab also to make a PDFaafigure ( https://launchpad.net/aafigure ) : set path to
aafigure
commandPlantUML ( http://plantuml.com/ ) : set path to
java
command. placeplantuml.jar
on working folder
Tables
The markup of table is //table[ID][caption]{ ... //}
You can separate header and content with ------------
.
The columns are splitted by TAB character. Write .
to blank cells. When the first character in the cell is .
, the character is removed. If you want to write .
at the first, you should write ..
.
When you want to use an empty column, you write .
.
Usage:
When you want to write "see table X", you can write @<table>{envvars}
.
You can use inline markup in the tables.
//table
without arguments creates a table without numbering and captioning.
To create a table without numbering but with captioning, use //emtable
.
Column width of table
When using LaTeX or IDGXML builder, you can specify each column width of the table with //tsize
block command.
The collumn width is specified in mm.
For IDGXML, if only 1st of the three columns is specified, the remaining 2nd and 3rd columns will be the width of the remainder of the live area width equally divided. It is not possible to specify that only the 1st and 3rd columns are specified.
For LaTeX, you have to specify all column widths.
For LaTeX, you can also directly specify the column parameter of LaTeX table macro like
//tsize[|latex||p{20mm}cr|]
.In other builders such as HTML, this command is simply ignored.
Complex Table
If you want to use complex tables, you can use imgtable
block command with an image of the table. imgtable
supports numbering and @<table>
.
Usage:
Quoting Text
You can use //quote{ ... //}
as quotations.
Usage:
You can use inline markup in quotations.
Short column
Some block commands are used for short column.
//note[caption]{ ... //}
//memo[caption]{ ... //}
//tip[caption]{ ... //}
//info[caption]{ ... //}
//warning[caption]{ ... //}
//important[caption]{ ... //}
//caution[caption]{ ... //}
//notice[caption]{ ... //}
[caption]
is optional.
The content is like paragraph; separated by empty lines.
From Re:VIEW 5.0, it is also possible to include itemize, figures and tables in short columns.
Footnotes
You can use //footnote
to write footnotes.
Usage:
@<fn>{site}
in source are replaced by footnote marks, and the phrase "support site of .." is in footnotes.
Note that in LATEXBuilder, it is highly recommended to place //footnote
after the end line of column (==[/column]
) to avoid problems when using third party's style file.
footnotetext
option
footnotetext
optionNote that in LATEXBuilder, you should use footnotetext
option to use @<fn>{...}
in //note
or other short column blocks.
By adding footnotetext:true
in config.yml, you can use footnote in tables and short notes.
Note that there are some constraints that (because of normal footnote )
And you cannot use footnote and footnotemark/footnotetext at the same time.
Note that with this option, Re:VIEW use footnotemark and footnotetext instead of normal footnote. There are some constraints to use this option. You cannot use footnote and footnotemark/footnotetext at the same time.
Bibliography
When you want to use a bibliography, you should write them in the file bib.re
.
The comment is optional.
Usage:
When you want to refer some references, You should write as:
Usage:
Lead Sentences
lead sentences are //lead{ ... //}
. You can write as //read{ ... //}
.
Usage:
TeX Equations
You can use //texequation{ ... //}
to insert mathematical equations of LaTeX.
Usage:
If you'd like to assign a number like 'Equation 1.1`, specify the identifier and caption.
To reference this, use the inline command @<eq>
.
There is @<m>{ ... }
for inline (see "Fence notation for inline commands" section also).
Whether LaTeX formula is correctly displayed or not depends on the processing system. PDFMaker uses LaTeX internally, so there is no problem.
In EPUBMaker and WEBMaker, you can choose between MathML conversion, MathJax conversion, and imaging.
MathML case
Install MathML library (gem install math_ml
).
Specify in config.yml as follows:
Whether it is displayed properly in MathML depends on your viewer or browser.
MathJax case
Specify in config.yml as follows:
MathJax JavaScript module is loaded from the Internet. Because the EPUB specification prohibits loading files from external, enabling this feature will cause the EPUB file to fail validation. Also MathJax will not work in almost all EPUB readers, but may be available with CSS formatting processor.
imaging case
This way calls LaTeX internally and images it with an external tool. Image files will be placed in images/_review_math
folder.
You need TeXLive or other LaTeX environment. Modify the parameters of texcommand
, texoptions
, dvicommand
, dvioptions
in config.yml as necessary.
In addition, external tools for image conversion are also needed. Currently, it supports the following two methods.
pdfcrop
: cut out the formula usingpdfcrop
command (included in TeXLive) and image it. By default,pdftocairo
command is used (included in Poppler library). You can change it to another tool if available on the command line.
By setting in config.yml,
it is set as follows:
For example, to make SVG:
By default, the command specified in pdfcrop_pixelize_cmd
takes the filename of multi-page PDF consisting of one formula per page.
If you want to use the sips
command or the magick
command, they can only process a single page, so you need to set extract_singlepage: true
to extract the specified page from the input PDF. pdfjam
command (in TeXLive) is used to extract pages.
To create PDF math images:
To set the same setting as Re:VIEW 2:
Spacing
//noindent
is a tag for spacing.
//noindent
: ingore indentation immediately following line. (in HTML, addnoindent
class)
Blank line
//blankline
put an empty line.
Usage:
Referring headings
There are 3 inline commands to refer a chapter. These references use Chapter ID. The Chapter ID is filename of chapter without extentions. For example, Chapter ID of advanced.re
is advance
.
@<chap>{ChapterID}
: chapter number (ex.Chapter 17
).@<title>{ChapterID}
: chapter title@<chapref>{ChapterID}
: chapter number and chapter title (ex.Chapter 17. other topics
).
@<hd>
generate referred section title and section number. You can use deeper section with separator |
.
Usage:
If section title is unique, |
is not needed.
If you want to refer another chapter (file), you should add the chapter ID.
Usage:
When section has the label, you can use the label.
Heading of columns
You can refer the heading of a column with @<column>
.
Usage:
You can refer labels.
Links
You can add a hyperlink with @<href>
and //label
. Notation of the markup is @<href>{URL, anchor}
. If you can use URL itself as anchor, use @<href>{URL}
. If you want to use ,
in URL, use \,
.
Usage:
Words file
By creating a word file with key / value pair, @<w>{key}
or @<wb>{key}
will be expanded the key to the corresponding value. @<wb>
means bold style.
This word file is a CSV file with extension .csv. This first columns is the key, the second row is the value.
Specify the word file path in words_file
parameter of config.yml
. You can specify multiple word files as word_file: ["common.csv", "mybook.csv"]
.
Usage:
(In HTML:)
Values are escaped by the builder. It is not possible to include inline commands in the value.
Comments
If you want to write some comments that do not output in the document, you can use comment notation #@#
.
Usage:
If you want to write some warnings, use #@warn(...)
.
Usage:
When you want to write comments in the output document, use //comment
and @<comment>
with the option --draft
of review-compile command.
Usage:
Raw Data Block
When you want to write non-Re:VIEW line, use //raw
or //embed
.
//raw
block
//raw
blockUsage:
In above line, html
is a builder name that handle raw data. You can use html
, latex
, idgxml
and top
as builder name. You can specify multiple builder names with separator ,
. is translated into newline(U+000A).
Output:
(In HTML:)
(In other formats, it is just ignored.)
Note: //raw
and @<raw>
may break structured document easily.
//embed
block
//embed
blockUsage:
In above line, html
and markdown
is a builder name that handle raw data.
Output:
(In HTML:)
(In other formats, it is just ignored.)
Nested itemize block
Re:VIEW itemize blocks basically cannot express nested items. Also, none of itemize blocks allow to contain another itemize block or paragraph/image/table/list.
As a workaround, Re:VIEW 4.2 provides an experimental //beginchild
and //endchild
. If you want to include something in an itemize block, enclose it with //beginchild
and //endchild
. It is also possible to create a multiple nest.
Output:
(In HTML:)
(This is an experimental implementation. Names and behaviors may change in future versions.)
Inline Commands
Styles
References
Other inline commands
Commands for Authors (pre-processor commands)
These commands are used in the output document. In contrast, commands as below are not used in the output document, used by the author.
You should use these commands with preprocessor command review-preproc
.
Internationalization (i18n)
Re:VIEW support I18N of some text like Chapter
, Figure
, and Table
. Current default language is Japanese.
You add the file locale.yml in the project directory.
Sample local.yml file:
If you want to customize texts, overwrite items. Default locale configuration file is in lib/review/i18n.yml.
Sample local.yml file:
Re:VIEW Custom Format
In locale.yml
, you can use these Re:VIEW custom format.
%pA
: Alphabet (A, B, C, ...)%pa
: alphabet (a, b, c, ...)%pAW
: Alphabet (Large Width) A, B, C, ...%paW
: alphabet (Large Width) a, b, c, ...%pR
: Roman Number (I, II, III, ...)%pr
: roman number (i, ii, iii, ...)%pRW
: Roman Number (Large Width) Ⅰ, Ⅱ, Ⅲ, ...%pJ
: Chainese Number 一, 二, 三, ...`%pdW' : Arabic Number (Large Width for 0..9) 1, 2, ...,9, 10, ...
`%pDW' : Arabic Number (Large Width) 1, 2, ... 10, ...
Usage:
Other Syntax
In Re:VIEW, you can add your customized blocks and inlines.
You can define customized commands in the file review-ext.rb
.
Usage:
You can add the syntax as below:
HTML/LaTeX Layout
layouts/layout.html.erb
and layouts/layout.tex.erb
are used as layout file. You can use ERb tags in the layout files.
Sample layout file(layout.html.erb):
Last updated