Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
DocBook
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Markup language for documentation}} {{Infobox file format | name = DocBook | icon = | logo = | extension = .dbk, .xml | mime = application/docbook+xml | type code = | uniform type = | magic = | owner = [[OASIS (organization)|OASIS]] | genre = [[markup language]] | container for = | contained by = | extended from = [[SGML]], [[XML]] | extended to = | open = Yes | standard = [http://docs.oasis-open.org/docbook/docbook/v5.2/os/docbook-v5.2-os.html 5.2 (February 2024)],<br/>[http://www.oasis-open.org/docbook/specs/docbook-4.5-spec.html 4.5 (October 2006)] }} '''DocBook''' is a [[Semantics (computer science)|semantic]] [[markup language]] for technical [[documentation]]. It was originally intended for writing technical documents related to computer hardware and software, but it can be used for any other sort of documentation.<ref>[http://docbook.org/whatis What is DocBook?]</ref> As a semantic language, DocBook enables its users to create [[separation of presentation and content|document content in a presentation-neutral form]] that captures the logical structure of the content; that content can then be published in a variety of formats, including [[HTML]], [[XHTML]], [[EPUB]], [[Portable Document Format|PDF]], [[Manual page (Unix)|man pages]], WebHelp<ref name="webhelp-1.76.1">[http://blog.kasunbg.com/2010/08/docbook-webhelp-project.html DocBook WebHelp Project]</ref> and [[Microsoft Compiled HTML Help|HTML Help]], without requiring users to make any changes to the source. In other words, when a document is written in DocBook format it becomes easily portable into other formats, rather than needing to be rewritten. == Design == DocBook is an [[XML]] language. In its current version (5.x), DocBook's language is formally defined by a [[RELAX NG]] [[XML schema|schema]] with integrated [[Schematron]] rules. (There are also [[W3C XML Schema]]+Schematron and [[Document Type Definition]] (DTD) versions of the schema available, but these are considered non-standard.) As a semantic language, DocBook documents do not describe what their contents "look like", but rather the meaning of those contents. For example, rather than explaining how the [[Abstract (summary)|abstract]] for an article might be visually formatted, DocBook simply says that a particular section ''is'' an abstract. It is up to an external processing tool or application to decide where on a page the abstract should go and what it should look like or whether or not it should be included in the final output at all. DocBook provides a vast number of semantic element tags. They are divided into three broad categories, namely structural, block-level, and inline. ''Structural'' tags specify broad characteristics of their contents. The <code>book</code> element, for example, specifies that its child elements represent the parts of a book. This includes a title, chapters, glossaries, appendices, and so on. DocBook's structural tags include, but are not limited to: * ''<code>set</code>:'' Titled collection of one or more <code>book</code>s or <code>article</code>s, can be nested with other sets * ''<code>book</code>:'' Titled collection of <code>chapter</code>s, <code>article</code>s, and/or <code>part</code>s, with optional glossaries, appendices, etc. * ''<code>part</code>:'' Titled collection of one or more <code>chapter</code>s—can be nested with other parts, and may have special introductory text * ''<code>article</code>:'' Titled, unnumbered collection of block-level elements * ''<code>chapter</code>:'' Titled, numbered collection of block-level elements—chapters don't require explicit numbers, a chapter number is the number of previous chapter elements in the XML document plus 1 * ''<code>appendix</code>:'' Contains text that represents an [[Addendum|appendix]] * ''<code>dedication</code>:'' Text represents the dedication of the contained structural element Structural elements can contain other structural elements. Structural elements are the only permitted top-level elements in a DocBook document. ''Block-level'' tags are elements like paragraph, lists, etc. Not all these elements can directly contain text. Sequential block-level elements render one "after" another. After, in this case, can differ depending on the language. In most Western languages, "after" means below: text paragraphs are printed down the page. Other languages' [[Writing system#Directionality|writing systems can have different directionality]]; for example, in Japanese, paragraphs are often printed in downward columns, with the columns running from right to left, so "after" in that case would be to the left. DocBook semantics are entirely neutral to these kinds of language-based concepts. ''Inline-level'' tags are elements like emphasis, hyperlinks, etc. They wrap text within a block-level element. These elements do not cause the text to break when rendered in a paragraph format, but typically they cause the document processor to apply some kind of distinct typographical treatment to the enclosed text, by changing the font, size, or similar attributes. (The DocBook specification ''does'' say that it expects different typographical treatment, but it does not offer specific requirements as to what this treatment may be.) That is, a DocBook processor doesn't have to transform an <code>emphasis</code> tag into ''italics''. A reader-based DocBook processor could increase the size of the words, or, a text-based processor could use bold instead of italics. === Sample document === <syntaxhighlight lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <book xml:id="simple_book" xmlns="http://docbook.org/ns/docbook" version="5.0"> <title>Very simple book</title> <chapter xml:id="chapter_1"> <title>Chapter 1</title> <para>Hello world!</para> <para>I hope that your day is proceeding <emphasis>splendidly</emphasis>!</para> </chapter> <chapter xml:id="chapter_2"> <title>Chapter 2</title> <para>Hello again, world!</para> </chapter> </book> </syntaxhighlight> Semantically, this document is a "book", with a "title", that contains two "chapters" each with their own "titles". Those "chapters" contain "paragraphs" that have text in them. The markup is fairly readable in English. In more detail, the root element of the document is <code>book</code>. All DocBook elements are in an [[XML Namespace]], so the root element has an ''xmlns'' attribute to set the current namespace. Also, the root element of a DocBook document must have a ''version'' that specifies the version of the format that the document is built on. (XML documents can include elements from multiple namespaces at once, like the <code>id</code> attributes in the example.) A <code>book</code> element must contain a <code>title</code>, or an <code>info</code> element containing a <code>title</code>. This must be before any child structural elements. Following the title are the structural children, in this case, two <code>chapter</code> elements. Each of these must have a <code>title</code>. They contain <code>para</code> block elements, which can contain free text and other inline elements like the <code>emphasis</code> in the second paragraph of the first chapter. === Schemas and validation === Rules are formally defined in the DocBook [[XML schema]]. Appropriate programming tools can validate an XML document (DocBook or otherwise), against its corresponding schema, to determine if (and where) the document fails to conform to that schema. XML editing tools can also use schema information to avoid creating non-conforming documents in the first place. == Authoring and processing == Because DocBook is XML, documents can be created and edited with any text editor. A dedicated [[XML editor]] is likewise a functional DocBook editor. DocBook provides [[XML schema|schema files]] for popular XML schema languages, so any XML editor that can provide content completion based on a schema can do so for DocBook. Many [[XML editor#Graphical editors|graphical]] or [[WYSIWYG]] [[XML editor#WYSIWYG editors|XML editors]] come with the ability to edit DocBook like a [[word processor]]. <ref name=":0">{{Cite web |title=DocBook Editing |url=https://www.oxygenxml.com/xml_editor/docbook_editor_structured_editing.html |access-date=2022-11-02 |website=www.oxygenxml.com}}</ref> Tables, list items, and other stylized content can be copied and pasted into the DocBook editor and will be preserved in the DocBook XML output. <ref name=":0" /> Because DocBook conforms to a well-defined XML schema, documents can be validated and processed using any tool or programming language that includes XML support. == History == DocBook began in 1991 in discussion groups on [[Usenet]] and eventually became a joint project of [[HAL Computer Systems]] and [[O'Reilly Media|O'Reilly & Associates]] and eventually spawned its own maintenance organization (the Davenport Group) before moving in 1998 to the ''SGML Open'' consortium, which subsequently became [[OASIS (organization)|OASIS]]. DocBook is currently maintained by the ''DocBook Technical Committee'' at OASIS.<ref>[http://www.docbook.org/tdg5/en/html/ch01.html Getting Started with DocBook]</ref> DocBook is available in both [[SGML]] and [[XML]] forms, as a [[Document Type Definition|DTD]]. [[RELAX NG]] and [[W3C XML Schema]] forms of the XML version are available. Starting with DocBook 5, the RELAX NG version is the "normative" form from which the other formats are generated. DocBook originally started out as an SGML application, but an equivalent XML application was developed and has now replaced the [[SGML]] one for most uses. (Starting with version 4 of the SGML DTD, the XML DTD continued with this version numbering scheme.) Initially, a key group of software companies used DocBook since their representatives were involved in its initial design. Eventually, however, DocBook was adopted by the open source community where it has become a standard for creating documentation for many projects, including [[FreeBSD]], [[KDE]], [[GNOME]] desktop documentation, the [[GTK+]] [[Application programming interface|API]] references, the [[Linux kernel]] documentation (which, as of July 2016, is transitioning to [[Sphinx (documentation generator)|Sphinx]]/[[reStructuredText]]<ref>{{Cite web|url=https://www.kernel.org/doc/html/v4.8/kernel-documentation.html|title = Linux Kernel Documentation — the Linux Kernel documentation}}</ref><ref>{{Cite web|url=https://lwn.net/Articles/692704/|title = Kernel documentation with Sphinx, part 1: How we got here [LWN.net]}}</ref>), and the work of the [[Linux Documentation Project]]. === Pre DocBook v5.0 === Until DocBook 5, DocBook was defined normatively by a Document Type Definition (DTD). Because DocBook was built originally as an application of [[SGML]], the DTD was the only available schema language. DocBook 4.x formats can be SGML or XML, but the XML version does not have its own namespace. DocBook 4.x formats had to live within the restrictions of being defined by a DTD. The most significant restriction was that an element name uniquely defines its possible contents. That is, an element named <code>info</code> must contain the same information no matter where it is in the DocBook file. As such, there are many kinds of info elements in DocBook 4.x: <code>bookinfo</code>, <code>chapterinfo</code>, etc. Each has a slightly different content model, but they do share some of their content model. Additionally, they repeat context information. The book's <code>info</code> element is that, because it is a direct child of the book; it does not need to be named specially for a human reader. However, because the format was defined by a DTD, it did have to be named as such. The root element does not have or need a ''version'', as the version is built into the DTD declaration at the top of a pre-DocBook 5 document. DocBook 4.x documents are not compatible with DocBook 5, but can be converted into DocBook 5 documents via an XSLT stylesheet. One (<code>db4-upgrade.xsl</code>) is provided as part of the distribution of the DocBook 5 schema and specification package.<ref>Jirka Kosek, Norman Walsh, Dick Hamilton, and Michael Smith, ''DocBook V5.0: The Transition Guide'', 16 June 2009, [http://docbook.org/docs/howto/#convert4to5 Converting DocBook V4.x documents to DocBook V5.0]</ref> == Output formats == DocBook files are used to prepare output files in a wide variety of formats. Nearly always, this is accomplished using [[DocBook XSL]] stylesheets. These are [[XSLT]] stylesheets that transform DocBook documents into a number of formats ([[HTML]], [[XSL-FO]] for later conversion into [[PDF]], etc.). These stylesheets can be sophisticated enough to generate tables of contents, glossaries, and indexes. They can oversee the selection of particular designated portions of a master document to produce different versions of the same document (such as a "tutorial" or a "quick-reference guide", where each of these consist of a subset of the material). Users can write their own customized stylesheets or even a full-fledged program to process the DocBook into an appropriate output format as their needs dictate. Norman Walsh and the DocBook Project development team maintain the key application for producing output from DocBook source documents: A set of [[XSLT]] stylesheets (as well as a legacy set of [[DSSSL]] stylesheets) that can generate high-quality [[HTML]] and print ([[XSL Formatting Objects|FO]]/[[Portable Document Format|PDF]]) output, as well as output in other formats, including [[Rich Text Format|RTF]], [[man page]]s and HTML Help. Web help<ref name=webhelp-1.76.1 /> is a chunked HTML output format in the [[DocBook XSL]] stylesheets that was introduced in version 1.76.1. The documentation for web help<ref>[http://docbook.sourceforge.net/release/xsl/current/webhelp/docs/index.html Web help documentation]</ref> also provides an example of web help and is part of the DocBook XSL distribution. The major features are its fully CSS-based page layout, search of the help content, and a table of contents in collapsible-tree form. Search has [[stemming]], match highlighting, explicit page-scoring, and the standard multilingual [[Tokenization (lexical analysis)|tokenizer]]. The search and TOC are in a pane that appears as a [[Frameset (HTML)|frameset]], but is actually implemented with [[div and span|div tags]] and cookies (so that it is progressive). == Simplified DocBook == DocBook offers a large number of features that may be overwhelming to a new user. For those who want the convenience of DocBook without a steep learning curve, ''Simplified DocBook'' was designed. It is a small subset of DocBook designed for single documents such as articles or white papers (i.e., "books" are not supported). The Simplified DocBook DTD is currently at version 1.1.<ref>[http://www.docbook.org/schemas/sdocbook/ Simplified DocBook]</ref> == Criticism == Ingo Schwarze, the author of [[OpenBSD]]'s [[mandoc]], considers DocBook inferior to the semantic ''mdoc'' macro for [[man pages]]. In an attempt to write a DocBook-to-mdoc converter (previous converters like docbook-to-man do not cover semantic elements), he finds the semantic parts "bloated, redundant, and incomplete at the same time" compared to elements covered in mdoc. Moreover, Schwarze finds the DocBook specification not specific enough about the use of tags, the language non-portable across versions, rough in details and overall inconsistent.<ref>{{cite web |last1=Schwarze |first1=Igor |title=docbook2mdoc-1.0.0 released |url=https://undeadly.org/cgi?action=article&sid=20190419101505 |website=OpenBSD Journal |date=April 19, 2019}}</ref> == See also == *[[List of document markup languages]] *[[Comparison of document markup languages]] *[[DocBook XSL]] *[[Darwin Information Typing Architecture]] *[[LinuxDoc]] *[[LaTeX]] == References == {{reflist}} == Further reading == Norman Walsh is the principal author of the book [http://www.docbook.org/tdg/ ''DocBook: The Definitive Guide''], the official documentation of DocBook. This book is available online under the [[GNU Free Documentation License|GFDL]], and also as a print publication. {{refbegin}} * {{ cite book | author = Norman Walsh | date = June 2010 | title = DocBook 5: The Definitive Guide | edition = 2nd | publisher = O'Reilly Associates | isbn = 978-0-596-80502-9 | url = http://www.docbook.org/ }} * {{ cite book | author = Bob Stayton | year = 2005 | title = DocBook XSL: The Complete Guide | edition = 3rd | publisher = Sagehill Enterprises | isbn = 0-9741521-2-9 | url = http://www.sagehill.net/docbookxsl/ }} * {{ cite book | author = Joe Brockmeier | year = 2001 | title = DocBook Publishing — A Better Way to Create Professional Documents | publisher = Prima Tech's Linux Series | isbn = 0-7615-3331-1 }} {{refend}} == External links == * [http://docbook.org DocBook.org] - Collection of DocBook information, including a 4.x and 5.0 version of ''DocBook: The Definitive Guide'' and all versions of the DocBook schemas/DTDs. * [http://www.oasis-open.org/docbook/ DocBook Repository at OASIS] - Normative home of DocBook schema/DTD. * [http://docbook.sourceforge.net DocBook XSL Project page] at [[SourceForge.net]], [https://github.com/docbook/xslt10-stylesheets XSLT 1.0 Stylesheets for DocBook] at [[GitHub]] * [http://tldp.org/HOWTO/DocBook-Demystification-HOWTO/ DocBook Demystification HOWTO] * [https://web.archive.org/web/20110629115314/http://www.karakas-online.de/forum/viewtopic.php?t=44156 DocBook: The Definitive Guide, 1st edition, v. 2.0.6] - Fully bookmarked PDF of the Guide for DocBook 3.x and 4.x. * [https://www.ibiblio.org/godoy/sgml/docbook/howto/writing-docbook.html Writing with DocBook elements]. {{OASIS Standards}} {{Document markup languages}} {{Authority control}} [[Category:DocBook| ]] [[Category:Markup languages]] [[Category:Document-centric XML-based standards]] [[Category:Technical communication]] [[Category:Technical communication tools]] [[Category:Software documentation]] [[Category:Open formats]] [[Category:SGML]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Document markup languages
(
edit
)
Template:Infobox file format
(
edit
)
Template:OASIS Standards
(
edit
)
Template:Refbegin
(
edit
)
Template:Refend
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)