Merged from mwolson@gnu.org--2006-muse-el (patch 92)
[muse-el.git] / examples / QuickStart.muse
blob4c0adffb07b2b43311c4a825e192719323e57e00
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 <contents>
14 * About this document
16 This document provides an example of Muse markup and also functions as
17 a quickstart for Muse.
19 To see what it looks like when published, type =make examples=.  You
20 will then get an Info document, an HTML document, and a PDF document
21 (provided you have an implementation of LaTeX installed with the
22 necessary fonts).
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                            This is centered
99   But if a line begins with whitespace, though less than six columns,
100   it indicates a quoted paragraph.
102 ** Headings
104 A heading becomes a chapter or section in printed output -- depending
105 on the style.  To indicate a heading, start a new paragraph with one
106 to three asterices, followed by a space and the heading title.  Then
107 begin another paragraph to enter the text for that section.
109 <example>
110 * First level
112 ** Second level
114 *** Third level
115 </example>
117 ** Horizontal rules
119 Four or more dashes indicate a horizontal rule.  Be sure to put blank
120 lines around it, or it will be considered part of the proceeding or
121 following paragraph!
123 ----
125 The separator above was produced by typing:
127 <example>
128 ----
129 </example>
131 ** Emphasizing text
133 To emphasize text, surround it with certain specially recognized
134 characters:
136 <example>
137 *emphasis*
138 **strong emphasis**
139 ***very strong emphasis***
140 _underlined_
141 =verbatim and monospace=
142 </example>
144 The above list renders as:
146 <verse>
147 *emphasis*
148 **strong emphasis**
149 ***very strong emphasis***
150 _underlined_
151 =verbatim and monospace=
152 </verse>
154 ** Adding footnotes
156 A footnote reference is simply a number in square
157 brackets<verbatim>[1]</verbatim>.[1] To define the footnote, place
158 this definition at the bottom of your file.  =footnote-mode= can be
159 used to greatly facilitate the creation of these kinds of footnotes.
161 <example>
162  Footnotes:
163  [1]  Footnotes are defined by the same number in brackets
164       occurring at the beginning of a line.  Use footnote-mode's
165       C-c ! a command, to very easily insert footnotes while
166       typing.  Use C-x C-x to return to the point of insertion.
167 </example>
169 ** Verse
171 Poetry requires that whitespace be preserved, but without resorting to
172 monospace.  To indicate this, use the following markup, reminiscent of
173 e-mail quotations:
175 <example>
176 > A line of Emacs verse;
177 >   forgive its being so terse.
178 </example>
180 The above is rendered as:
182 > A line of Emacs verse;
183 >   forgive its being so terse.
185 You can also use the =<literal><verse></literal>= tag, if you prefer:
187 <example>
188 <verse>
189 A line of Emacs verse;
190   forgive its being so terse.
191 </verse>
192 </example>
194 ** Literal paragraphs
196 The =<literal><example></literal>= tag is used for examples, where
197 whitespace should be preserved, the text rendered in monospace, and
198 any characters special to the output style escaped.
200 There is also the =<literal><literal></literal>= tag, which causes a
201 marked block to be entirely left alone.  This can be used for
202 inserting a hand-coded HTML blocks into HTML output, for example.
204 ** Lists
206 Lists are given using special characters at the beginning of a line.
207 Whitespace must occur before bullets or numbered items, to distinguish
208 from the possibility of those characters occurring in a real sentence.
210 The supported kinds of lists are:
212 <example>
213   - bullet item one
214   - bullet item two
216   1. Enumerated item one
217   2. Enumerated item two
219 Term1 :: A definition one
221 Term2 :: A definition two
222 </example>
224 These are rendered as a bullet list:
226   - bullet item one
227   - bullet item two
229 An enumerated list:
231   1. Enum item one
232   2. Enum item two
234 And a definition list:
236 Term1 ::
237   This is a first definition
238   And it has two lines;
239   no, make that three.
241 Term2 ::
242   This is a second definition
244 ** Tables
246 Only very simple tables are supported.  The syntax is:
248 <example>
249   Double bars  || Separate header fields
251   Single bars   | Separate body fields
252   Here are more | body fields
254   Triple bars ||| Separate footer fields
255 </example>
257 The above is rendered as:
259 Double bars  || Separate header fields
261 Single bars   | Separate body fields
262 Here are more | body fields
264 Triple bars ||| Separate footer fields
266 <comment>
267 Double bars  || Separate header fields
269 Single bars   | Separate body fields
270 Here are more | body fields
272 Triple bars ||| Separate footer fields
273 </comment>
275 ** Anchors and tagged links
277 #example If you begin a line with "#anchor" -- where "anchor" can be
278 any word that doesn't contain whitespace -- it defines an anchor at
279 that point into the document.  This point can be referenced using
280 "page#anchor" as the target in a Muse link (see below).
282 Click [[#example][here]] to go back to the previous paragraph.
284 ** URLs and E-mail addresses
286 A URL or e-mail address encountered in the input text is published as
287 a hyperlink if the output style supports it.  If it is an image URL,
288 it will be inlined if possible.  For example, the latest Muse source
289 can be downloaded at http://download.gna.org/muse-el and mail may be
290 sent to mwolson@gnu.org.
292 ** Links
294 A hyperlink can reference a URL, or another page within a Muse
295 project.  In addition, descriptive text can be specified, which should
296 be displayed rather than the link text in output styles that supports
297 link descriptions.  The syntax is:
299 <example>
300 [[link target][link description]]
301 [[link target without description]]
302 </example>
304 Thus, Muse can be downloaded [[http://download.gna.org/muse-el/][here]], or at
305 [[http://download.gna.org/muse-el/]].
307 ** Embedded lisp
309 Arbitrary kinds of markup can be achieved using the
310 =<literal><lisp></literal>= tag, which is the only Muse tag supported
311 in a style's header and footer text.  With the
312 =<literal><lisp></literal>= tag, you may generated whatever output
313 text you wish.  The inserted output will get marked up, if the
314 =<literal><lisp></literal>= tag appears within the main text of the
315 document.
317 <example>
318 <lisp>(concat "This form gets " "inserted")</lisp>
319 </example>
321 The above renders as: <lisp>(concat "This form gets " "inserted")</lisp>.
323 * Publishing styles
325 One of the principle features of Muse is the ability to publish a
326 simple input text to a variety of different output styles.  Muse also
327 makes it easy to create new styles, or derive from an existing style.
329 ** Deriving from an existing style
331 To create a new style from an existing one, use =muse-derive-style=:
333 <example>
334 (muse-derive-style DERIVED-NAME BASE-NAME STYLE-PARAMETERS)
335 </example>
337 The derived name is a string defining the new style, such as
338 "my-html".  The base name must identify an existing style, such as
339 "html" -- if you have loaded =muse-html=.  The style parameters are
340 the same as those used to create a style, except that they override
341 whatever definitions exist in the base style.  However, some
342 definitions only partially override.  Those which support partial
343 overriding are:
345  - =:functions= -- If a markup function is not found in the derived
346    style's function list, the base style's function list will be
347    queried.
349  - =:strings=
351  - =:before=
353  - =:before-end=
355  - =:after=
357 ** Overriding an existing style
359 Write me.
361 ** Creating a new style
363 Write me.
365 Footnotes:
366 [1]  This is a footnote.