muse-html: Add muse-xhtml-style-sheet.
[muse-el.git] / examples / QuickStart
blobf76a8bf6fceaf64749da533fd345b2bf1f115a6f
1 #author John Wiegley
2 #title The Emacs Muse
4 Emacs Muse is an authoring and publishing environment for Emacs.  It
5 simplifies the process of writings documents and publishing them to
6 various output formats.
8 Muse consists of two main parts: an enhanced text-mode for authoring
9 documents and navigating within Muse projects, and a set of publishing
10 styles for generating different kinds of output.
12 * About this document
14 This document provides an example of Muse markup and also functions as
15 a quickstart for Muse.
17 To see what it looks like when published, type =make examples=.  You
18 will then get an Info document, an HTML document, and a PDF document
19 (provided you have an implementation of LaTeX installed with the
20 necessary fonts).
22 <contents>
24 * Getting Started
26 To use Muse, add the directory containing its files to your
27 =load-path= variable, in your =.emacs= file.  Then, load in the
28 authoring mode, and the styles you wish to publish to.  For example:
30 <example>
31 (add-to-list 'load-path "<path to Muse>")
33 (require 'muse-mode)     ; load authoring mode
35 (require 'muse-html)     ; load publishing styles I use
36 (require 'muse-latex)
37 (require 'muse-texinfo)
38 (require 'muse-docbook)
39 </example>
41 Once loaded, the command =M-x muse-publish-this-file= will publish an
42 input document to any available style.  If you enable =muse-mode=
43 within a buffer, by typing =M-x muse-mode=, this command will be bound
44 to =C-c C-t=.
46 * Creating a Muse project
48 Often you will want to publish all the files within a directory to a
49 particular set of output styles automatically.  To support, Muse
50 allows for the creations of "projects".  Here is a sample project, to
51 be defined in your =.emacs= file:
53 <example>
54 (require 'muse-project)
56 (setq muse-project-alist
57       '(("website"                      ; my various writings
58          ("~/Pages" :default "index")
59          (:base "html" :path "~/public_html")
60          (:base "pdf" :path "~/public_html/pdf"))))
61 </example>
63 The above defines a project named "website", whose files are located
64 in the directory =~/Pages=.  The default page to visit is =index=.
65 When this project is published, each page will be output as HTML to
66 the directory =~/public_html=, and as PDF to the directory
67 =~/public_html/pdf=.  Within any project page, you may create a link
68 to other pages using the syntax =[[pagename]]=.
70 * Markup rules
72 A Muse document uses special, contextual markup rules to determine how
73 to format the output result.  For example, if a paragraph is indented,
74 Muse assumes it should be quoted.
76 There are not too many markup rules, and all of them strive to be as
77 simple as possible so that you can focus on document creation, rather
78 than formatting.
80 ** Paragraphs
82 Separate paragraphs in Muse must be separate by a blank line.
84 For example, the input text used for this section is:
86 <example>
87 Separate paragraphs in Muse must be separate by a blank line.
89 For example, the input text used for this section is:
90 </example>
92 ** Centered paragraphs and quotations
94 A line that begins with six or more columns of whitespace (either tabs
95 or spaces) indicates a centered paragraph.
97 <comment>
98                            This is centered
99 </comment>
101   But if a line begins with whitespace, though less than six columns,
102   it indicates a quoted paragraph.
104 ** Headings
106 A heading becomes a chapter or section in printed output -- depending
107 on the style.  To indicate a heading, start a new paragraph with one
108 to three asterices, followed by a space and the heading title.  Then
109 begin another paragraph to enter the text for that section.
111 <example>
112 * First level
114 ** Second level
116 *** Third level
117 </example>
119 ** Horizontal rules
121 Four or more dashes indicate a horizontal rule.  Be sure to put blank
122 lines around it, or it will be considered part of the proceeding or
123 following paragraph!
125 ----
127 The separator above was produced by typing:
129 <example>
130 ----
131 </example>
133 ** Emphasizing text
135 To emphasize text, surround it with certain specially recognized
136 characters:
138 <example>
139 *emphasis*
140 **strong emphasis**
141 ***very strong emphasis***
142 _underlined_
143 =verbatim and monospace=
144 </example>
146 The above list renders as:
148 <verse>
149 *emphasis*
150 **strong emphasis**
151 ***very strong emphasis***
152 _underlined_
153 =verbatim and monospace=
154 </verse>
156 ** Adding footnotes
158 A footnote reference is simply a number in square
159 brackets<verbatim>[1]</verbatim>.[1] To define the footnote, place
160 this definition at the bottom of your file.  =footnote-mode= can be
161 used to greatly facilitate the creation of these kinds of footnotes.
163 <example>
164  Footnotes:
165  [1]  Footnotes are defined by the same number in brackets
166       occurring at the beginning of a line.  Use footnote-mode's
167       C-c ! a command, to very easily insert footnotes while
168       typing.  Use C-x C-x to return to the point of insertion.
169 </example>
171 ** Verse
173 Poetry requires that whitespace be preserved, but without resorting to
174 monospace.  To indicate this, use the following markup, reminiscent of
175 e-mail quotations:
177 <example>
178 > A line of Emacs verse;
179 >   forgive its being so terse.
180 </example>
182 The above is rendered as:
184 > A line of Emacs verse;
185 >   forgive its being so terse.
187 You can also use the =<literal><verse></literal>= tag, if you prefer:
189 <example>
190 <verse>
191 A line of Emacs verse;
192   forgive its being so terse.
193 </verse>
194 </example>
196 ** Literal paragraphs
198 The =<literal><example></literal>= tag is used for examples, where
199 whitespace should be preserved, the text rendered in monospace, and
200 any characters special to the output style escaped.
202 There is also the =<literal><literal></literal>= tag, which causes a
203 marked block to be entirely left alone.  This can be used for
204 inserting a hand-coded HTML blocks into HTML output, for example.
206 ** Lists
208 Lists are given using special characters at the beginning of a line.
209 Whitespace must occur before bullets or numbered items, to distinguish
210 from the possibility of those characters occurring in a real sentence.
212 The supported kinds of lists are:
214 <example>
215   - bullet item one
216   - bullet item two
218   1. Enumerated item one
219   2. Enumerated item two
221 Term1 :: A definition one
223 Term2 :: A definition two
224 </example>
226 These are rendered as a bullet list:
228   - bullet item one
229   - bullet item two
231 An enumerated list:
233   1. Enum item one
234   2. Enum item two
236 And a definition list:
238 Term1 ::
239   This is a first definition
240   And it has two lines;
241   no, make that three.
243 Term2 ::
244   This is a second definition
246 ** Tables
248 Only very simple tables are supported.  The syntax is:
250 <example>
251   Double bars  || Separate header fields
253   Single bars   | Separate body fields
254   Here are more | body fields
256   Triple bars ||| Separate footer fields
257 </example>
259 The above is rendered as:
261 Double bars  || Separate header fields
263 Single bars   | Separate body fields
264 Here are more | body fields
266 Triple bars ||| Separate footer fields
268 <comment>
269 Double bars  || Separate header fields
271 Single bars   | Separate body fields
272 Here are more | body fields
274 Triple bars ||| Separate footer fields
275 </comment>
277 ** Anchors and tagged links
279 #example If you begin a line with "#anchor" -- where "anchor" can be
280 any word that doesn't contain whitespace -- it defines an anchor at
281 that point into the document.  This point can be referenced using
282 "page#anchor" as the target in a Muse link (see below).
284 Click [[#example][here]] to go back to the previous paragraph.
286 ** URLs and E-mail addresses
288 A URL or e-mail address encountered in the input text is published as
289 a hyperlink if the output style supports it.  If it is an image URL,
290 it will be inlined if possible.  For example, the latest Muse source
291 can be downloaded at
292 http://www.newartisans.com/johnw/Emacs/muse.tar.gz and mail may be
293 sent to johnw@gnu.org
295 ** Links
297 A hyperlink can reference a URL, or another page within a Muse
298 project.  In addition, descriptive text can be specified, which should
299 be displayed rather than the link text in output styles that supports
300 link descriptions.  The syntax is:
302 <example>
303 [[link target][link description]]
304 [[link target without description]]
305 </example>
307 Thus, Muse can be downloaded [[http://download.gna.org/muse-el/][here]], or at
308 [[http://download.gna.org/muse-el/]].
310 ** Embedded lisp
312 Arbitrary kinds of markup can be achieved using the
313 =<literal><lisp></literal>= tag, which is the only Muse tag supported
314 in a style's header and footer text.  With the
315 =<literal><lisp></literal>= tag, you may generated whatever output
316 text you wish.  The inserted output will get marked up, if the
317 =<literal><lisp></literal>= tag appears within the main text of the
318 document.
320 <example>
321 <lisp>(concat "This form gets " "inserted")</lisp>
322 </example>
324 The above renders as: <lisp>(concat "This form gets " "inserted")</lisp>.
326 * Publishing styles
328 One of the principle features of Muse is the ability to publish a
329 simple input text to a variety of different output styles.  Muse also
330 makes it easy to create new styles, or derive from an existing style.
332 ** Deriving from an existing style
334 To create a new style from an existing one, use =muse-derive-style=:
336 <example>
337 (muse-derive-style DERIVED-NAME BASE-NAME STYLE-PARAMETERS)
338 </example>
340 The derived name is a string defining the new style, such as
341 "my-html".  The base name must identify an existing style, such as
342 "html" -- if you have loaded =muse-html=.  The style parameters are
343 the same as those used to create a style, except that they override
344 whatever definitions exist in the base style.  However, some
345 definitions only partially override.  Those which support partial
346 overriding are:
348  - =:functions= -- If a markup function is not found in the derived
349    style's function list, the base style's function list will be
350    queried.
352  - =:strings=
354  - =:before=
356  - =:before-end=
358  - =:after=
360 ** Overriding an existing style
362 Write me.
364 ** Creating a new style
366 Write me.
368 Footnotes:
369 [1]  This is a footnote.