1 #author John Wiegley and Michael Olson
4 Emacs Muse is an authoring and publishing environment for Emacs. It
5 simplifies the process of writing 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) ; publish 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.
209 <literal style="html">HTML</literal>
210 <literal style="pdf">PDF</literal>
211 <literal style="info">Info</literal>
212 version of this document.
218 <literal style="html">HTML</literal>
219 <literal style="pdf">PDF</literal>
220 <literal style="info">Info</literal>
221 version of this document.
224 <literal style="latex">
225 LaTeX was used in the publishing of this document.
231 <literal style="latex">
232 LaTeX was used in the publishing of this document.
237 Lists are given using special characters at the beginning of a line.
238 Whitespace must occur before bullets or numbered items, to distinguish
239 from the possibility of those characters occurring in a real sentence.
241 The supported kinds of lists are:
247 1. Enumerated item one
248 2. Enumerated item two
250 Term1 :: A definition one
252 Term2 :: A definition two
255 These are rendered as a bullet list:
265 And a definition list:
268 This is a first definition
269 And it has two lines;
273 This is a second definition
275 Lists may be nested inside of one another. The level of nesting is
276 determined by the amount of leading whitespace.
279 - Level 1, bullet item one
280 1. Level 2, enum item one
281 2. Level 2, enum item two
282 - Level 1, bullet item two
287 - Level 1, bullet item one
288 1. Level 2, enum item one
289 2. Level 2, enum item two
290 - Level 1, bullet item two
294 Simple tables are supported. The syntax is:
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 The above is rendered as:
307 Double bars || Separate header fields
309 Single bars | Separate body fields
310 Here are more | body fields
312 Triple bars ||| Separate footer fields
315 Double bars || Separate header fields
317 Single bars | Separate body fields
318 Here are more | body fields
320 Triple bars ||| Separate footer fields
323 It is also possible to make tables that look like:
326 | Single bars | Separate body fields |
327 | Here are more | body fields |
332 | Single bars | Separate body fields |
333 | Here are more | body fields |
335 If you are familiar with Org-mode style tables, simple variants (no
336 column groups or autogenerated formulas) will publish fine. Also,
337 table.el style tables will be published, provided that the output
338 format is something that table.el supports.
340 ** Anchors and tagged links
342 #example If you begin a line with "#anchor" -- where "anchor" can be
343 any word that doesn't contain whitespace -- it defines an anchor at
344 that point into the document. This point can be referenced using
345 "page#anchor" as the target in a Muse link (see below).
347 Click [[#example][here]] to go back to the previous paragraph.
349 ** URLs and E-mail addresses
351 A URL or e-mail address encountered in the input text is published as
352 a hyperlink if the output style supports it. For example, the latest
353 Muse source can be downloaded at http://download.gna.org/muse-el and
354 mail may be sent to mwolson@gnu.org.
358 If a URL has an extension of a known image format, it will be inlined
359 if possible. To create a link to an image, rather than inlining it,
360 put the text "URL:" immediately in front of the link.
362 This is an inlined image example:
365 Made with [[muse-made-with.png]] Emacs Muse.
370 Made with [[muse-made-with.png]] Emacs Muse.
372 Here is an example of a captioned image:
375 [[emacs-muse.png][Emacs Muse, the publishing choice of (a subset of) Great Thinkers]]
380 [[emacs-muse.png][Emacs Muse, the publishing choice of (a subset of) Great Thinkers]]
382 The following will be published as a link only.
385 The Muse logo: [[URL:http://mwolson.org/static/logos/emacs-muse.png]].
388 The Muse logo: [[URL:http://mwolson.org/static/logos/emacs-muse.png]].
392 A hyperlink can reference a URL, or another page within a Muse
393 project. In addition, descriptive text can be specified, which should
394 be displayed rather than the link text in output styles that supports
395 link descriptions. The syntax is:
398 [[link target][link description]]
399 [[link target without description]]
405 Muse can be downloaded [[http://download.gna.org/muse-el/][here]], or at
406 [[http://download.gna.org/muse-el/]].
411 Muse can be downloaded [[http://download.gna.org/muse-el/][here]], or at
412 [[http://download.gna.org/muse-el/]].
416 If you have htmlize.el version 1.34 or later installed, you can
417 publish colorized HTML for source code in any major mode that Emacs
418 supports by using the =<literal><src></literal>= tag. If not publishing
419 to HTML, the text between the tags will be treated like an
420 =<literal><example></literal>= tag.
422 Here is some example C code. Muse takes the =lang= element and appends
423 ="-mode"= to it in order to determine which major mode to use when
432 int main (int argc, char *argv[])
434 puts("Hello, world!\n");
439 Here is the colorized output. This may look different if you have
440 customized some faces. Also, it may look different depending on
441 whether you are publishing from Emacs on the console, or Emacs on X --
442 what you see when viewing (in this case) a C file is what you get.
449 int main (int argc, char *argv[])
451 puts("Hello, world!\n");
455 ** Embedded Lisp, Perl, Ruby, Python, or Shell
457 Arbitrary kinds of markup can be achieved using the
458 =<literal><lisp></literal>= tag, which is the only Muse tag supported
459 in a style's header and footer text. With the
460 =<literal><lisp></literal>= tag, you may generated whatever output
461 text you wish. The inserted output will get marked up, if the
462 =<literal><lisp></literal>= tag appears within the main text of the
466 <lisp>(concat "This form gets " "inserted")</lisp>
469 The above renders as: <lisp>(concat "This form gets " "inserted")</lisp>.
471 It is also possible to treat the output as if it were surrounded by
472 the =<literal><example></literal>=, =<literal><src></literal>=, or
473 =<literal><verse></literal>= tags, by specifying ="example"=, ="src"=, or
474 ="verse"= as the =markup= attribute of the tag.
479 <lisp markup="example">
480 (concat "Insert" " me")
486 <lisp markup="example">
487 (concat "Insert" " me")
490 This =markup= attribute can also be passed to the
491 =<literal><perl></literal>=, =<literal><ruby></literal>=,
492 =<literal><python></literal>=, and =<literal><command></literal>= tags,
493 which interpret Perl, Ruby, Python, and Shell code, respectively.
497 One of the principle features of Muse is the ability to publish a
498 simple input text to a variety of different output styles. Muse also
499 makes it easy to create new styles, or derive from an existing style.
501 ** Deriving from an existing style
503 To create a new style from an existing one, use =muse-derive-style=:
506 (muse-derive-style DERIVED-NAME BASE-NAME STYLE-PARAMETERS)
509 The derived name is a string defining the new style, such as
510 "my-html". The base name must identify an existing style, such as
511 "html" -- if you have loaded =muse-html=. The style parameters are the
512 same as those used to create a style, except that they override
513 whatever definitions exist in the base style.
515 Most often, this will come in handy for using a custom header, footer,
516 and/or stylesheet for a project. Here is one such example.
519 (setq my-different-style-sheet
520 (concat "<link rel=\"stylesheet\" type=\"text/css\""
521 " charset=\"utf-8\" media=\"all\""
522 " href=\"/different.css\" />"))
524 (muse-derive-style "my-xhtml" "xhtml"
525 :header "~/.emacs.d/muse/different-header.html"
526 :footer "~/.emacs.d/muse/different-footer.html"
527 :style-sheet my-different-style-sheet)
530 Many parameters support being partially overridden. As an example:
531 with =:functions=, if a markup function is not found in the derived
532 style's function list, the base style's function list will be queried.
534 If a parameter takes the name of a function, then returning non-nil
535 from that function causes no further processing to be done. If the
536 function returns nil, any other functions in the base style will be
539 ** Creating a new style
541 To create a new style, use =muse-define-style=:
544 (muse-define-style NAME STYLE-PARAMETERS)
547 If you want to create a new style, it is best to examine the source
548 code for other styles first, to get an idea of what needs to be done.
549 Each output format should have its own file, containing all styles
550 based on it. For example. the =latex=, =latex-slides=, and =pdf= styles are
551 all contained in =muse-latex.el=.
553 If you are willing to sign copyright papers for the Free Software
554 Foundation (we will help you with this step), the Muse authors may be
555 interested in including your work in future versions of Muse.
559 This QuickStart document may be redistributed and/or modified under
560 the terms of the GNU General Public License as published by the Free
561 Software Foundation; either version 3, or (at your option) any later
566 [1] This is a footnote.
568 [2] Another footnote, this one unreferenced.