1 #author John Wiegley and Michael Olson
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.
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
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:
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
37 (require 'muse-texinfo)
38 (require 'muse-docbook)
40 (require 'muse-project) ; group files in projects
43 Once loaded, the command =M-x muse-publish-this-file= will publish an
44 input document to any available style. If you enable =muse-mode=
45 within a buffer, by typing =M-x muse-mode=, this command will be bound
48 * Creating a Muse project
50 Often you will want to publish all the files within a directory to a
51 particular set of output styles automatically. To support, Muse
52 allows for the creations of "projects". Here is a sample project, to
53 be defined in your =.emacs= file:
56 (setq muse-project-alist
57 '(("website" ("~/Pages" :default "index")
58 (:base "html" :path "~/public_html")
59 (:base "pdf" :path "~/public_html/pdf"))))
62 The above defines a project named "website", whose files are located
63 in the directory =~/Pages=. The default page to visit is =index=.
64 When this project is published, each page will be output as HTML to
65 the directory =~/public_html=, and as PDF to the directory
66 =~/public_html/pdf=. Within any project page, you may create a link
67 to other pages using the syntax =[[pagename]]=.
71 A Muse document uses special, contextual markup rules to determine how
72 to format the output result. For example, if a paragraph is indented,
73 Muse assumes it should be quoted.
75 There are not too many markup rules, and all of them strive to be as
76 simple as possible so that you can focus on document creation, rather
81 Separate paragraphs in Muse must be separate by a blank line.
83 For example, the input text used for this section is:
86 Separate paragraphs in Muse must be separate by a blank line.
88 For example, the input text used for this section is:
91 ** Centered paragraphs and quotations
93 A line that begins with six or more columns of whitespace (either tabs
94 or spaces) indicates a centered paragraph.
98 But if a line begins with whitespace, though less than six columns,
99 it indicates a quoted paragraph.
103 A heading becomes a chapter or section in printed output -- depending
104 on the style. To indicate a heading, start a new paragraph with one
105 to three asterices, followed by a space and the heading title. Then
106 begin another paragraph to enter the text for that section.
118 Four or more dashes indicate a horizontal rule. Be sure to put blank
119 lines around it, or it will be considered part of the proceeding or
124 The separator above was produced by typing:
132 To emphasize text, surround it with certain specially recognized
138 ***very strong emphasis***
140 =verbatim and monospace=
143 The above list renders as:
148 ***very strong emphasis***
150 =verbatim and monospace=
155 A footnote reference is simply a number in square
156 brackets<verbatim>[1]</verbatim>.[1] To define the footnote, place
157 this definition at the bottom of your file. =footnote-mode= can be
158 used to greatly facilitate the creation of these kinds of footnotes.
162 [1] Footnotes are defined by the same number in brackets
163 occurring at the beginning of a line. Use footnote-mode's
164 C-c ! a command, to very easily insert footnotes while
165 typing. Use C-x C-x to return to the point of insertion.
170 Poetry requires that whitespace be preserved, but without resorting to
171 monospace. To indicate this, use the following markup, reminiscent of
175 > A line of Emacs verse;
176 > forgive its being so terse.
179 The above is rendered as:
181 > A line of Emacs verse;
182 > forgive its being so terse.
184 You can also use the =<literal><verse></literal>= tag, if you prefer:
188 A line of Emacs verse;
189 forgive its being so terse.
193 ** Literal paragraphs
195 The =<literal><example></literal>= tag is used for examples, where
196 whitespace should be preserved, the text rendered in monospace, and
197 any characters special to the output style escaped.
199 There is also the =<literal><literal></literal>= tag, which causes a
200 marked block to be entirely left alone. This can be used for
201 inserting a hand-coded HTML blocks into HTML output, for example.
203 If you want some text to only be inserted when publishing to a
204 particular format, use the =style= attribute for the
205 =<literal><literal></literal>= tag. Some examples follow.
208 <literal style="html">HTML</literal>
209 <literal style="pdf">PDF</literal>
210 <literal style="info">Info</literal>
211 version of this document.
213 <literal style="latex">
214 LaTeX was used in the publishing of this document.
219 Lists are given using special characters at the beginning of a line.
220 Whitespace must occur before bullets or numbered items, to distinguish
221 from the possibility of those characters occurring in a real sentence.
223 The supported kinds of lists are:
229 1. Enumerated item one
230 2. Enumerated item two
232 Term1 :: A definition one
234 Term2 :: A definition two
237 These are rendered as a bullet list:
247 And a definition list:
250 This is a first definition
251 And it has two lines;
255 This is a second definition
257 Lists may be nested inside of one another. The level of nesting is
258 determined by the amount of leading whitespace.
261 - Level 1, bullet item one
262 1. Level 2, enum item one
263 2. Level 2, enum item two
264 - Level 1, bullet item two
269 - Level 1, bullet item one
270 1. Level 2, enum item one
271 2. Level 2, enum item two
272 - Level 1, bullet item two
276 Simple tables are supported. The syntax is:
279 Double bars || Separate header fields
281 Single bars | Separate body fields
282 Here are more | body fields
284 Triple bars ||| Separate footer fields
287 The above is rendered as:
289 Double bars || Separate header fields
291 Single bars | Separate body fields
292 Here are more | body fields
294 Triple bars ||| Separate footer fields
297 Double bars || Separate header fields
299 Single bars | Separate body fields
300 Here are more | body fields
302 Triple bars ||| Separate footer fields
305 It is also possible to make tables that look like:
308 | Single bars | Separate body fields |
309 | Here are more | body fields |
314 | Single bars | Separate body fields |
315 | Here are more | body fields |
317 If you are familiar with Org-mode style tables, simple variants (no
318 column groups or autogenerated formulas) will publish fine. Also,
319 table.el style tables will be published, provided that the output
320 format is something that table.el supports.
322 ** Anchors and tagged links
324 #example If you begin a line with "#anchor" -- where "anchor" can be
325 any word that doesn't contain whitespace -- it defines an anchor at
326 that point into the document. This point can be referenced using
327 "page#anchor" as the target in a Muse link (see below).
329 Click [[#example][here]] to go back to the previous paragraph.
331 ** URLs and E-mail addresses
333 A URL or e-mail address encountered in the input text is published as
334 a hyperlink if the output style supports it. For example, the latest
335 Muse source can be downloaded at http://download.gna.org/muse-el and
336 mail may be sent to mwolson@gnu.org.
340 If a URL has an extension of a known image format, it will be inlined
341 if possible. To create a link to an image, rather than inlining it,
342 put the text "URL:" immediately in front of the link.
344 This is an inlined image example:
347 Made with [[http://mwolson.org/static/logos/muse-made-with.png]] Emacs Muse.
352 Made with [[http://mwolson.org/static/logos/muse-made-with.png]] Emacs Muse.
354 Here is an example of a captioned image:
357 [[http://mwolson.org/static/logos/emacs-muse.png][Muse, the publishing choice of Great Thinkers]]
362 [[http://mwolson.org/static/logos/emacs-muse.png][Emacs Muse, the publishing choice of (a subset of) Great Thinkers]]
364 The following will be published as a link only.
367 The Muse logo: [[URL:http://mwolson.org/static/logos/emacs-muse.png]].
370 The Muse logo: [[URL:http://mwolson.org/static/logos/emacs-muse.png]].
374 A hyperlink can reference a URL, or another page within a Muse
375 project. In addition, descriptive text can be specified, which should
376 be displayed rather than the link text in output styles that supports
377 link descriptions. The syntax is:
380 [[link target][link description]]
381 [[link target without description]]
387 Muse can be downloaded [[http://download.gna.org/muse-el/][here]], or at
388 [[http://download.gna.org/muse-el/]].
393 Muse can be downloaded [[http://download.gna.org/muse-el/][here]], or at
394 [[http://download.gna.org/muse-el/]].
398 If you have htmlize.el version 1.34 or later installed, you can
399 publish colorized HTML for source code in any major mode that Emacs
400 supports by using the =<literal><src></literal>= tag. If not publishing
401 to HTML, the text between the tags will be treated like an
402 =<literal><example></literal>= tag.
404 Here is some example C code. Muse takes the =lang= element and appends
405 ="-mode"= to it in order to determine which major mode to use when
414 int main (int argc, char *argv[])
416 puts("Hello, world!\n");
421 Here is the colorized output. This may look different if you have
422 customized some faces.
429 int main (int argc, char *argv[3])
431 puts("Hello, world!\n");
435 ** Embedded Lisp, Perl, Ruby, Python, or Shell
437 Arbitrary kinds of markup can be achieved using the
438 =<literal><lisp></literal>= tag, which is the only Muse tag supported
439 in a style's header and footer text. With the
440 =<literal><lisp></literal>= tag, you may generated whatever output
441 text you wish. The inserted output will get marked up, if the
442 =<literal><lisp></literal>= tag appears within the main text of the
446 <lisp>(concat "This form gets " "inserted")</lisp>
449 The above renders as: <lisp>(concat "This form gets " "inserted")</lisp>.
451 It is also possible to treat the output as if it were surrounded by
452 the =<literal><example></literal>=, =<literal><src></literal>=, or
453 =<literal><verse></literal>= tags, by specifying ="example"=, ="src"=, or
454 ="verse"= as the =markup= attribute of the tag.
459 <lisp markup="example">
460 (concat "Insert" " me")
466 <lisp markup="example">
467 (concat "Insert" " me")
470 This =markup= attribute can also be passed to the
471 =<literal><perl></literal>=, =<literal><ruby></literal>=,
472 =<literal><python></literal>=, and =<literal><command></literal>= tags,
473 which interpret Perl, Ruby, Python, and Shell code, respectively.
477 One of the principle features of Muse is the ability to publish a
478 simple input text to a variety of different output styles. Muse also
479 makes it easy to create new styles, or derive from an existing style.
481 ** Deriving from an existing style
483 To create a new style from an existing one, use =muse-derive-style=:
486 (muse-derive-style DERIVED-NAME BASE-NAME STYLE-PARAMETERS)
489 The derived name is a string defining the new style, such as
490 "my-html". The base name must identify an existing style, such as
491 "html" -- if you have loaded =muse-html=. The style parameters are the
492 same as those used to create a style, except that they override
493 whatever definitions exist in the base style.
495 Most often, this will come in handy for using a custom header, footer,
496 and/or stylesheet for a project. Here is one such example.
499 (setq my-different-style-sheet
500 (concat "<link rel=\"stylesheet\" type=\"text/css\""
501 " charset=\"utf-8\" media=\"all\""
502 " href=\"/different.css\" />"))
504 (muse-derive-style "my-xhtml" "xhtml"
505 :header "~/.emacs.d/muse/different-header.html"
506 :footer "~/.emacs.d/muse/different-footer.html"
507 :style-sheet my-different-style-sheet)
510 Many parameters support being partially overridden. As an example:
511 with =:functions=, if a markup function is not found in the derived
512 style's function list, the base style's function list will be queried.
514 If a parameter takes the name of a function, then returning non-nil
515 from that function causes no further processing to be done. If the
516 function returns nil, any other functions in the base style will be
519 ** Creating a new style
521 To create a new style, use =muse-define-style=:
524 (muse-define-style NAME STYLE-PARAMETERS)
527 If you want to create a new style, it is best to examine the source
528 code for other styles first, to get an idea of what needs to be done.
529 Each output format should have its own file, containing all styles
530 based on it. For example. the =latex=, =latex-slides=, and =pdf= styles are
531 all contained in =muse-latex.el=.
533 If you are willing to sign copyright papers for the Free Software
534 Foundation (we will help you with this step), the Muse authors may be
535 interested in including your work in future versions of Muse.
539 This QuickStart document may be redistributed and/or modified under
540 the terms of the GNU General Public License as published by the Free
541 Software Foundation; either version 2, or (at your option) any later
546 [1] This is a footnote.
548 [2] Another footnote, this one unreferenced.