diff options
author | alexbiehl <alex.biehl@gmail.com> | 2017-08-21 20:05:42 +0200 |
---|---|---|
committer | alexbiehl <alex.biehl@gmail.com> | 2017-08-21 20:05:42 +0200 |
commit | 7a71af839bd71992a36d97650004c73bf11fa436 (patch) | |
tree | e64afbc9df5c97fde6ac6433e42f28df8a4acf49 /doc | |
parent | c8a01b83be52e45d3890db173ffe7b09ccd4f351 (diff) | |
parent | 740458ac4d2acf197f2ef8dc94a66f9b160b9c3c (diff) |
Merge remote-tracking branch 'origin/master' into ghc-head
Diffstat (limited to 'doc')
-rw-r--r-- | doc/cheatsheet/LICENSE | 428 | ||||
-rw-r--r-- | doc/cheatsheet/README.md | 9 | ||||
-rw-r--r-- | doc/cheatsheet/haddocks.md | 120 | ||||
-rw-r--r-- | doc/cheatsheet/haddocks.pdf | bin | 0 -> 30765 bytes | |||
-rw-r--r-- | doc/cheatsheet/haddocks.svg | 624 | ||||
-rw-r--r-- | doc/invoking.rst | 5 | ||||
-rw-r--r-- | doc/markup.rst | 450 |
7 files changed, 1543 insertions, 93 deletions
diff --git a/doc/cheatsheet/LICENSE b/doc/cheatsheet/LICENSE new file mode 100644 index 00000000..fd662a7e --- /dev/null +++ b/doc/cheatsheet/LICENSE @@ -0,0 +1,428 @@ +Attribution-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-ShareAlike 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-ShareAlike 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + + including for purposes of Section 3(b); and + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. + diff --git a/doc/cheatsheet/README.md b/doc/cheatsheet/README.md new file mode 100644 index 00000000..c5856217 --- /dev/null +++ b/doc/cheatsheet/README.md @@ -0,0 +1,9 @@ +![License: CC BY-SA 4.0](https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg) + +# Haddock Markup Quick Reference + +This page is a single-page quick reference for the markup used in GHC's [Haddock](https://www.haskell.org/haddock/) documentation format. It doesn't list all the details of the format, just the basic markup, so for the vagaries and edge-cases of the syntax, it would be helpful to consult the [Haddock user guide](http://haskell-haddock.readthedocs.io/en/latest/index.html). + +## License + +This document is licensed under the CC BY-SA 4.0 license. diff --git a/doc/cheatsheet/haddocks.md b/doc/cheatsheet/haddocks.md new file mode 100644 index 00000000..fbe71392 --- /dev/null +++ b/doc/cheatsheet/haddocks.md @@ -0,0 +1,120 @@ +# Code Sections + +``` + -- * Section + -- ** Sub-section + -- *** Sub-sub-section + -- et cetera +``` + +# Named Documentation Chunks + +``` + -- $name +[...] + -- $name + -- Here is the documentation text + -- which is embedded elsewhere +``` + +# Code Blocks + +``` +With internal markup: + -- @ + -- fact n = product [1..n] + -- @ +With literal text: + -- > fact n = product [1..n] +``` + +# REPL Examples + +``` + -- >>> fact 5 + -- 120 +``` + +# Properties + +``` + -- prop> a + b = b + a +``` + +# Hyperlinked Identifiers + +``` + -- The value 'x' of type 'T' + -- The out-of-scope 'MyModule.x' + -- The "MyModule" module +``` + +# Textual Markup + +``` + -- Emphasis: /forward slashes/. + -- Bolding: __underscores__. + -- Monospaced text: @ampersands@. +``` + +# Links and Images + +``` + -- A raw link <http://example.com> + -- [a link](http://example.com) + -- ![description](imagepath.png) +``` + +# Lists + +``` +itemized with "*" or "-" + -- * first item + -- * second item +numbered with "(n)" or "n." + -- 1. first item + -- 2. second item +definitions with "[thing]" + -- [one] first item + -- [two] second item +``` + +# Mathematics/LaTeX + +``` + -- \[ + -- f(n) = \Sum_{i=1}^{n} i + -- \] + \\ when \(n > 0\) +``` + +# Headings in Documentation + +``` + -- = Heading + -- == Sub-heading + -- === Sub-sub-heading +``` + +# Metadata + +``` + -- @since 1.2.3 +``` + +# Module Attributes + +``` +{-# OPTIONS_HADDOCK hide #-} + Omit this module from the docs +{-# OPTIONS_HADDOCK prune #-} + Omit definitions without docs +{-# OPTIONS_HADDOCK ignore-exports #-} + Treat this module as though all + top-level items are exported +{-# OPTIONS_HADDOCK not-home #-} + Do not treat this module as the + "home" of identifiers it exports +{-# OPTIONS_HADDOCK show-extensions #-} + Show all enabled LANGUAGE extensions +``` diff --git a/doc/cheatsheet/haddocks.pdf b/doc/cheatsheet/haddocks.pdf Binary files differnew file mode 100644 index 00000000..130e8595 --- /dev/null +++ b/doc/cheatsheet/haddocks.pdf diff --git a/doc/cheatsheet/haddocks.svg b/doc/cheatsheet/haddocks.svg new file mode 100644 index 00000000..ea08781f --- /dev/null +++ b/doc/cheatsheet/haddocks.svg @@ -0,0 +1,624 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="8.5in" + height="11in" + viewBox="0 0 170 220" + version="1.1" + id="svg8" + inkscape:version="0.92.1 r" + sodipodi:docname="haddocks.svg" + inkscape:export-filename="/home/gdritter/projects/haddock-cheatsheet/haddocks.png" + inkscape:export-xdpi="100" + inkscape:export-ydpi="100"> + <defs + id="defs2" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.99607843" + inkscape:pageshadow="2" + inkscape:zoom="1.1689792" + inkscape:cx="338.82394" + inkscape:cy="776.62735" + inkscape:document-units="in" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:snap-smooth-nodes="true" + inkscape:snap-intersection-paths="true" + units="in" + scale-x="20" + inkscape:window-width="1918" + inkscape:window-height="1036" + inkscape:window-x="0" + inkscape:window-y="42" + inkscape:window-maximized="0" + showguides="true" + inkscape:guide-bbox="true"> + <inkscape:grid + type="xygrid" + id="grid4485" /> + </sodipodi:namedview> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-17.599983)"> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="9.2960958" + y="44.426563" + id="text4489"><tspan + sodipodi:role="line" + x="9.2960958" + y="44.426563" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + id="tspan4497">Code Sections</tspan><tspan + sodipodi:role="line" + x="9.2960958" + y="49.229057" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4507"> -- * Section</tspan><tspan + sodipodi:role="line" + x="9.2960958" + y="54.461079" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4511"> -- ** Sub-section</tspan><tspan + sodipodi:role="line" + x="9.2960958" + y="59.6931" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4513"> -- *** Sub-sub-section</tspan><tspan + sodipodi:role="line" + x="9.2960958" + y="64.925117" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4515"> -- et cetera</tspan></text> + <text + id="text4569" + y="70.848915" + x="9.3546734" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="70.848915" + x="9.3546734" + sodipodi:role="line" + id="tspan4753">Named Documentation Chunks</tspan><tspan + id="tspan4567" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82077742px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="75.651405" + x="9.3546734" + sodipodi:role="line"> -- $name</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82077742px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="80.955017" + x="9.3546734" + sodipodi:role="line" + id="tspan4580"><tspan + style="font-size:2.82077742px;fill:#808080;stroke-width:0.24425368px" + id="tspan4586">[...]</tspan></tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82077742px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="86.258629" + x="9.3546734" + sodipodi:role="line" + id="tspan4578"> -- $name</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82077742px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="91.562233" + x="9.3546734" + sodipodi:role="line" + id="tspan4582"> -- Here is the documentation text</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82077742px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="96.865845" + x="9.3546734" + sodipodi:role="line" + id="tspan4584"> -- which is embedded elsewhere</tspan></text> + <text + id="text4661" + y="102.25972" + x="9.3546734" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4647" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="102.25972" + x="9.3546734" + sodipodi:role="line">Code Blocks</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + y="107.06221" + x="9.3546734" + sodipodi:role="line" + id="tspan4649">With internal markup:</tspan><tspan + id="tspan4651" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="112.29424" + x="9.3546734" + sodipodi:role="line"> -- @</tspan><tspan + id="tspan4653" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="117.52625" + x="9.3546734" + sodipodi:role="line"> -- fact n = product [1..n]</tspan><tspan + id="tspan4655" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="122.75829" + x="9.3546734" + sodipodi:role="line"> -- @</tspan><tspan + id="tspan4657" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + y="127.9903" + x="9.3546734" + sodipodi:role="line">With literal text:</tspan><tspan + id="tspan4659" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="133.22232" + x="9.3546734" + sodipodi:role="line"> -- > fact n = product [1..n]</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="9.3546734" + y="140.30173" + id="text4602"><tspan + sodipodi:role="line" + x="9.3546734" + y="140.30173" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + id="tspan4588">REPL Examples</tspan><tspan + sodipodi:role="line" + x="9.3546734" + y="145.10422" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4629"> -- >>> fact 5</tspan><tspan + sodipodi:role="line" + x="9.3546734" + y="150.33624" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4674"> -- 120</tspan></text> + <text + id="text4692" + y="156.90796" + x="9.3546734" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4680" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="156.90796" + x="9.3546734" + sodipodi:role="line">Properties</tspan><tspan + id="tspan4690" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="161.71045" + x="9.3546734" + sodipodi:role="line"> -- prop> a + b = b + a</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.3177433px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24289316px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="9.5486708" + y="169.6808" + id="text4731"><tspan + sodipodi:role="line" + x="9.5486708" + y="169.6808" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.59010696px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24289316px" + id="tspan4727">Hyperlinked Identifiers</tspan><tspan + sodipodi:role="line" + x="9.5486708" + y="174.45654" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.06007123px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24289316px" + id="tspan4729"> -- The value 'x' of type 'T'</tspan><tspan + sodipodi:role="line" + x="9.5486708" + y="179.65942" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.06007123px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24289316px" + id="tspan4733"> -- The out-of-scope 'MyModule.x'</tspan><tspan + sodipodi:role="line" + x="9.5486708" + y="184.8623" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.06007123px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24289316px" + id="tspan4747"> -- The "MyModule" module</tspan></text> + <text + id="text4741" + y="192.34953" + x="9.3546734" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4735" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="192.34953" + x="9.3546734" + sodipodi:role="line">Textual Markup</tspan><tspan + id="tspan4737" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="197.15202" + x="9.3546734" + sodipodi:role="line"> -- Emphasis: /forward slashes/.</tspan><tspan + id="tspan4739" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="202.38405" + x="9.3546734" + sodipodi:role="line"> -- Bolding: __underscores__.</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="207.61607" + x="9.3546734" + sodipodi:role="line" + id="tspan4745"> -- Monospaced text: @at signs@.</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="9.3546734" + y="215.33546" + id="text4771"><tspan + sodipodi:role="line" + x="9.3546734" + y="215.33546" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + id="tspan4763">Links and Images</tspan><tspan + id="tspan4769" + sodipodi:role="line" + x="9.3546734" + y="220.13795" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px"> -- A raw link <http://example.com></tspan><tspan + sodipodi:role="line" + x="9.3546734" + y="225.36998" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4780"> -- [a link](http://example.com)</tspan><tspan + sodipodi:role="line" + x="9.3546734" + y="230.60201" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4778"> -- ![description](imagepath.png)</tspan></text> + <text + id="text4806" + y="44.426563" + x="89.102867" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4796" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="44.426563" + x="89.102867" + sodipodi:role="line">Lists</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="49.229057" + x="89.102867" + sodipodi:role="line" + id="tspan4812" /><tspan + id="tspan4798" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + y="49.229057" + x="89.102867" + sodipodi:role="line">itemized with "*" or "-"</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="54.461079" + x="89.102867" + sodipodi:role="line" + id="tspan4814"> -- * first item</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="59.6931" + x="89.102867" + sodipodi:role="line" + id="tspan4810"> -- * second item</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + y="64.925117" + x="89.102867" + sodipodi:role="line" + id="tspan4816">numbered with "(n)" or "n."</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="70.157143" + x="89.102867" + sodipodi:role="line" + id="tspan4818"> -- 1. first item</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="75.38916" + x="89.102867" + sodipodi:role="line" + id="tspan4822"> -- 2. second item</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + y="80.621185" + x="89.102867" + sodipodi:role="line" + id="tspan4826">definitions with "[thing]"</tspan><tspan + id="tspan4804" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="85.853203" + x="89.102867" + sodipodi:role="line"> -- [one] first item</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="91.085228" + x="89.102867" + sodipodi:role="line" + id="tspan4834"> -- [two] second item</tspan></text> + <text + id="text4936" + y="98.872009" + x="89.102867" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4920" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="98.872009" + x="89.102867" + sodipodi:role="line">Mathematics/LaTeX</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="103.6745" + x="89.102867" + sodipodi:role="line" + id="tspan4922" /><tspan + id="tspan4924" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="103.6745" + x="89.102867" + sodipodi:role="line" /><tspan + id="tspan4926" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="103.6745" + x="89.102867" + sodipodi:role="line"> -- \[</tspan><tspan + id="tspan4928" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="108.90652" + x="89.102867" + sodipodi:role="line"> -- f(n) = \Sum_{i=1}^{n} i</tspan><tspan + id="tspan4930" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="114.13854" + x="89.102867" + sodipodi:role="line"> -- \]</tspan><tspan + id="tspan4934" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="119.37056" + x="89.102867" + sodipodi:role="line"> -- when \(n > 0\)</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="89.102867" + y="126.79274" + id="text4984"><tspan + sodipodi:role="line" + x="89.102867" + y="126.79274" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + id="tspan4970">Headings in Documentation</tspan><tspan + id="tspan4972" + sodipodi:role="line" + x="89.102867" + y="131.59523" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" /><tspan + sodipodi:role="line" + x="89.102867" + y="131.59523" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4974" /><tspan + sodipodi:role="line" + x="89.102867" + y="131.59523" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4982"> -- = Heading</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="136.82726" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4995"> -- == Sub-heading</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="142.05928" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4997"> -- === sub-sub-heading</tspan></text> + <text + id="text5011" + y="149.362" + x="89.102867" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4999" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="149.362" + x="89.102867" + sodipodi:role="line">Metadata</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="154.16449" + x="89.102867" + sodipodi:role="line" + id="tspan5001" /><tspan + id="tspan5009" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="154.16449" + x="89.102867" + sodipodi:role="line" /><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="154.16449" + x="89.102867" + sodipodi:role="line" + id="tspan5018"> -- @since 1.2.3</tspan></text> + <flowRoot + xml:space="preserve" + id="flowRoot5020" + style="font-style:normal;font-weight:normal;font-size:96px;line-height:25px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + transform="matrix(0.92316354,0,0,0.92316354,5.4302439,15.266139)"><flowRegion + id="flowRegion5022"><rect + id="rect5024" + width="238.32765" + height="162.11119" + x="435.52261" + y="59.137138" /></flowRegion><flowPara + id="flowPara5026" /></flowRoot> <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="89.102867" + y="161.86107" + id="text5038"><tspan + sodipodi:role="line" + x="89.102867" + y="161.86107" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + id="tspan5028">Module Attributes</tspan><tspan + id="tspan5030" + sodipodi:role="line" + x="89.102867" + y="166.66356" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" /><tspan + id="tspan5036" + sodipodi:role="line" + x="89.102867" + y="166.66356" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" /><tspan + sodipodi:role="line" + x="89.102867" + y="166.66356" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5044">{-# OPTIONS_HADDOCK hide #-}</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="171.89558" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5048"><tspan + style="fill:#808080;stroke-width:0.24425368px" + id="tspan5080"> Omit this module from the docs</tspan></tspan><tspan + sodipodi:role="line" + x="89.102867" + y="177.12761" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5050">{-# OPTIONS_HADDOCK prune #-}</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="182.35962" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5054"><tspan + style="fill:#808080;stroke-width:0.24425368px" + id="tspan5082"> Omit definitions without docs</tspan></tspan><tspan + sodipodi:role="line" + x="89.102867" + y="187.59164" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5056">{-# OPTIONS_HADDOCK ignore-exports #-}</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="192.82367" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5060"><tspan + style="fill:#808080;stroke-width:0.24425368px" + id="tspan5084"> Treat this module as though all</tspan></tspan><tspan + sodipodi:role="line" + x="89.102867" + y="198.05569" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + id="tspan5064"> top-level items are exported</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="203.2877" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5066">{-# OPTIONS_HADDOCK not-home #-}</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="208.51973" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + id="tspan5068"> Do not treat this module as the</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="213.75175" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + id="tspan5078"> "home" of identifiers it exports</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="218.98378" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5070">{-# OPTIONS_HADDOCK show-extensions #-}</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="224.21579" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5072"><tspan + style="fill:#808080;stroke-width:0.24425368px" + id="tspan5086"> Show all enabled LANGUAGE extensions</tspan></tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:20px;line-height:5.20833302px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.20833333px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="5.544848" + y="32.398926" + id="text5294"><tspan + sodipodi:role="line" + id="tspan5292" + x="5.544848" + y="32.398926" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:13.33333302px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.20833333px">Haddock Markup</tspan></text> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.78740158;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" + d="M 6.2499999,37.599983 H 162.5" + id="path5504" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:20px;line-height:5.20833302px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.20833333px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="121.27747" + y="21.599566" + id="text5529"><tspan + sodipodi:role="line" + id="tspan5527" + x="121.27747" + y="29.399044" + style="stroke-width:0.20833333px" /></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.22222233px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#666666;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="163.25969" + y="21.504742" + id="text4489-0"><tspan + sodipodi:role="line" + x="163.25969" + y="21.504742" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5579">Haddock Markup Cheat-sheet, Version 1.1</tspan><tspan + sodipodi:role="line" + x="163.25969" + y="24.28252" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5571">Getty Ritter (<tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#666666" + id="tspan5597">@aisamanra</tspan>)</tspan><tspan + sodipodi:role="line" + x="163.25969" + y="27.060297" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5565">github.com/aisamanra/haddock-cheatsheet</tspan><tspan + sodipodi:role="line" + x="163.25969" + y="29.838076" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5601" /><tspan + sodipodi:role="line" + x="163.25969" + y="32.615852" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5605">This work is licensed under a Creative Commons</tspan><tspan + sodipodi:role="line" + x="163.25969" + y="35.393631" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5593">Attribution-ShareAlike 4.0 International License</tspan></text> + </g> +</svg> diff --git a/doc/invoking.rst b/doc/invoking.rst index 83087bac..fc1e4410 100644 --- a/doc/invoking.rst +++ b/doc/invoking.rst @@ -88,6 +88,11 @@ The following options are available: :option:`--read-interface` option for more details. The interface file is in a binary format; don't try to read it. +.. option:: --show-interface=<file> + + Dumps a binary interface file to stdout in a human readable fashion. + Uses json as output format. + .. [1] Haddock interface files are not the same as Haskell interface files, I just couldn't think of a better name. diff --git a/doc/markup.rst b/doc/markup.rst index b0ebc738..d0b9392d 100644 --- a/doc/markup.rst +++ b/doc/markup.rst @@ -8,7 +8,7 @@ will just generate documentation that contains the type signatures, data type declarations, and class declarations exported by each of the modules being processed. -Documenting a top-level declaration +Documenting a Top-Level Declaration ----------------------------------- The simplest example of a documentation annotation is for documenting @@ -35,6 +35,8 @@ the following: - A type signature for a top-level function, +- A definition for a top-level function with no type signature, + - A ``data`` declaration, - A ``newtype`` declaration, @@ -57,9 +59,12 @@ this is possible in Haddock too: :: -- ^The 'square' function squares an integer. square x = x * x -Note that Haddock doesn't contain a Haskell type system — if you don't -write the type signature for a function, then Haddock can't tell what -its type is and it won't be included in the documentation. +Since Haddock uses the GHC API internally, it can infer types for +top-level functions without type signatures. However, you're +encouraged to add explicit type signatures for all top-level +functions, to make your source code more readable for your users, and +at times to avoid GHC inferring overly general type signatures that +are less helpful to your users. Documentation annotations may span several lines; the annotation continues until the first non-comment line in the source file. For @@ -81,13 +86,13 @@ comments: :: square :: Int -> Int square x = x * x -Documenting parts of a declaration +Documenting Parts of a Declaration ---------------------------------- In addition to documenting the whole declaration, in some cases we can also document individual parts of the declaration. -Class methods +Class Methods ~~~~~~~~~~~~~ Class methods are documented in the same way as top level type @@ -99,7 +104,7 @@ signatures, by using either the ``-- |`` or ``-- ^`` annotations: :: -- | This is the documentation for the 'g' method g :: Int -> a -Constructors and record fields +Constructors and Record Fields ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Constructors are documented like so: :: @@ -150,7 +155,7 @@ would join up documentation of each field and render the result. The reason for this seemingly weird behaviour is the fact that ``someField`` is actually the same (partial) function. -Function arguments +Function Arguments ~~~~~~~~~~~~~~~~~~ Individual arguments to a function may be documented like this: :: @@ -159,7 +164,9 @@ Individual arguments to a function may be documented like this: :: -> Float -- ^ The 'Float' argument -> IO () -- ^ The return value -The module description +.. _module-description: + +The Module Description ---------------------- A module itself may be documented with multiple fields that can then be @@ -183,50 +190,100 @@ module documentation example and then talk about the fields. :: module W where ... -The “Module” field should be clear. It currently doesn't affect the -output of any of the backends but you might want to include it for human -information or for any other tools that might be parsing these comments +All fields are optional but they must be in order if they do appear. +Multi-line fields are accepted but the consecutive lines have to start +indented more than their label. If your label is indented one space as +is often the case with the ``--`` syntax, the consecutive lines have +to start at two spaces at the very least. For example, above we saw a +multiline ``Copyright`` field: :: + + {-| + ... + Copyright : (c) Some Guy, 2013 + Someone Else, 2014 + ... + -} + +That could equivalently be written as :: + + -- | ... + -- Copyright: + -- (c) Some Guy, 2013 + -- Someone Else, 2014 + -- ... + +or as :: + + -- | ... + -- Copyright: (c) Some Guy, 2013 + -- Someone Else, 2014 + -- ... + +but not as :: + + -- | ... + -- Copyright: (c) Some Guy, 2013 + -- Someone Else, 2014 + -- ... + +since the ``Someone`` needs to be indented more than the +``Copyright``. + +Whether new lines and other formatting in multiline fields is +preserved depends on the field type. For example, new lines in the +``Copyright`` field are preserved, but new lines in the +``Description`` field are not; leading whitespace is not preserved in +either [#backend]_. Please note that we do not enforce the format for +any of the fields and the established formats are just a convention. + +.. [#backend] Technically, whitespace and newlines in the + ``Description`` field are preserved verbatim by the HTML backend, + but because most browsers collapse whitespace in HTML, they don't + render as such. But other backends may render this whitespace. + +Fields of the Module Description +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``Module`` field specifies the current module name. Since the module +name can be inferred automatically from the source file, it doesn't +affect the output of any of the backends. But you might want to +include it for any other tools that might be parsing these comments without the help of GHC. -The “Description” field accepts some short text which outlines the +The ``Description`` field accepts some short text which outlines the general purpose of the module. If you're generating HTML, it will show up next to the module link in the module index. -The “Copyright”, “License”, “Maintainer” and “Stability” fields should -be obvious. An alternative spelling for the “License” field is accepted -as “Licence” but the output will always prefer “License”. +The ``Copyright``, ``License``, ``Maintainer`` and ``Stability`` fields should +be obvious. An alternative spelling for the ``License`` field is accepted +as ``Licence`` but the output will always prefer ``License``. -The “Portability” field has seen varied use by different library +The ``Portability`` field has seen varied use by different library authors. Some people put down things like operating system constraints there while others put down which GHC extensions are used in the module. -Note that you might want to consider using the “show-extensions” module -flag for the latter. +Note that you might want to consider using the ``show-extensions`` module +flag for the latter (see :ref:`module-attrs`). -Finally, a module may contain a documentation comment before the module -header, in which case this comment is interpreted by Haddock as an -overall description of the module itself, and placed in a section -entitled “Description” in the documentation for the module. All usual -Haddock markup is valid in this comment. +Finally, a module may contain a documentation comment before the +module header, in which case this comment is interpreted by Haddock as +an overall description of the module itself, and placed in a section +entitled ``Description`` in the documentation for the module. All the +usual Haddock :ref:`markup` is valid in this comment. -All fields are optional but they must be in order if they do appear. -Multi-line fields are accepted but the consecutive lines have to start -indented more than their label. If your label is indented one space as -is often the case with “--” syntax, the consecutive lines have to start -at two spaces at the very least. Please note that we do not enforce the -format for any of the fields and the established formats are just a -convention. - -Controlling the documentation structure +Controlling the Documentation Structure --------------------------------------- Haddock produces interface documentation that lists only the entities -actually exported by the module. The documentation for a module will +actually exported by the module. If there is no export list then all +entities defined by the module are exported. + +The documentation for a module will include *all* entities exported by that module, even if they were -re-exported by another module. The only exception is when Haddock can't +re-exported from another module. The only exception is when Haddock can't see the declaration for the re-exported entity, perhaps because it isn't part of the batch of modules currently being processed. -However, to Haddock the export list has even more significance than just +To Haddock the export list has even more significance than just specifying the entities to be included in the documentation. It also specifies the *order* that entities will be listed in the generated documentation. This leaves the programmer free to implement functions in @@ -237,9 +294,154 @@ is often used as a kind of ad-hoc interface documentation, with headings, groups of functions, type signatures and declarations in comments. +In the next section we give examples illustrating most of the +structural markup features. After the examples we go into more detail +explaining the related markup, namely :ref:`section-headings`, +:ref:`named-chunks`, and :ref:`re-exporting-entire-module`. + +.. _structure-examples: + +Documentation Structure Examples +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +We now give several examples that produce similar results and +illustrate most of the structural markup features. The first two +example use an export list, but the third example does not. + +The first example, using an export list with :ref:`section-headings` +and inline section descriptions: :: + + module Image + ( -- * Image importers + -- + -- | There is a "smart" importer, 'readImage', that determines + -- the image format from the file extension, and several + -- "dumb" format-specific importers that decode the file at + -- the specified type. + readImage + , readPngImage + , readGifImage + , ... + -- * Image exporters + -- ... + ) where + + import Image.Types ( Image ) + + -- | Read an image, guessing the format from the file name. + readImage :: FilePath -> IO Image + readImage = ... + + -- | Read a GIF. + readGifImage :: FilePath -> IO Image + readGifImage = ... + + -- | Read a PNG. + readPngImage :: FilePath -> IO Image + readPngImage = ... + + ... + +Note that the order of the entities ``readPngImage`` and +``readGifImage`` in the export list is different from the order of the +actual declarations farther down; the order in the export list is the +order used in the generated docs. Also, the imported ``Image`` type +itself is not re-exported, so it will not be included in the rendered +docs (see :ref:`hyperlinking-re-exported`). + +The second example, using an export list with a section description +defined elsewhere (the ``$imageImporters``; see :ref:`named-chunks`): +:: + + module Image + ( -- * Image importers + -- + -- $imageImporters + readImage + , readPngImage + , readGifImage + , ... + -- * Image exporters + -- ... + ) where + + import Image.Types ( Image ) + + -- $imageImporters + -- + -- There is a "smart" importer, 'readImage', that determines the + -- image format from the file extension, and several "dumb" + -- format-specific importers that decode the file at the specified + -- type. + + -- | Read an image, guessing the format from the file name. + readImage :: FilePath -> IO Image + readImage = ... + + -- | Read a GIF. + readGifImage :: FilePath -> IO Image + readGifImage = ... + + -- | Read a PNG. + readPngImage :: FilePath -> IO Image + readPngImage = ... + + ... + +This produces the same rendered docs as the first example, but the +source code itself is arguably more readable, since the documentation +for the group of importer functions is closer to their definitions. + +The third example, without an export list: :: + + module Image where + + import Image.Types ( Image ) + + -- * Image importers + -- + -- $imageImporters + -- + -- There is a "smart" importer, 'readImage', that determines the + -- image format from the file extension, and several "dumb" + -- format-specific importers that decode the file at the specified + -- type. + + -- | Read an image, guessing the format from the file name. + readImage :: FilePath -> IO Image + readImage = ... + + -- | Read a GIF. + readGifImage :: FilePath -> IO Image + readGifImage = ... + + -- | Read a PNG. + readPngImage :: FilePath -> IO Image + readPngImage = ... + + ... + + -- * Image exporters + -- ... + +Note that the section headers (e.g. ``-- * Image importers``) now +appear in the module body itself, and that the section documentation +is still given using :ref:`named-chunks`. Unlike in the first example +when using an export list, the named chunk syntax ``$imageImporters`` +*must* be used for the section documentation; attempting to use the +``-- | ...`` syntax to document the image importers here will wrongly +associate the documentation chunk with the next definition! + +.. _section-headings: + +Section Headings +~~~~~~~~~~~~~~~~ + You can insert headings and sub-headings in the documentation by -including annotations at the appropriate point in the export list. For -example: :: +including annotations at the appropriate point in the export list, or +in the module body directly when not using an export list. + +For example: :: module Foo ( -- * Classes @@ -276,7 +478,31 @@ line is also supported. e.g.: :: , g ) where -Re-exporting an entire module +When not using an export list, you may insert section headers in the +module body. Such section headers associate with all entities +declaried up until the next section header. For example: :: + + module Foo where + + -- * Classes + class C a where ... + + -- * Types + -- ** A data type + data T = ... + + -- ** A record + data R = ... + + -- * Some functions + f :: ... + f = ... + g :: ... + g = ... + +.. _re-exporting-entire-module: + +Re-Exporting an Entire Module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Haskell allows you to re-export the entire contents of a module (or at @@ -292,8 +518,10 @@ What will the Haddock-generated documentation for this module look like? Well, it depends on how the modules ``B`` and ``C`` are imported. If they are imported wholly and without any ``hiding`` qualifiers, then the documentation will just contain a cross-reference to the documentation -for ``B`` and ``C``. However, if the modules are not *completely* -re-exported, for example: :: +for ``B`` and ``C``. + +However, if the modules are not *completely* re-exported, for example: +:: module A ( module B, @@ -304,48 +532,39 @@ re-exported, for example: :: import C (a, b) then Haddock behaves as if the set of entities re-exported from ``B`` -and ``C`` had been listed explicitly in the export list [2]_. +and ``C`` had been listed explicitly in the export list [#notImplemented]_. + +.. Comment: was this ever implemented? Perhaps this part of the docs + should just be removed until it is implemented? -.. [2] - NOTE: this is not fully implemented at the time of writing (version - 0.2). At the moment, Haddock always inserts a cross-reference. +.. [#notImplemented] This is not implemented at the time of writing + (Haddock version 2.17.3 with GHC 8.0.2). At the moment, Haddock + always inserts a module cross-reference. The exception to this rule is when the re-exported module is declared -with the ``hide`` attribute (:ref:`module-attrs`), in which case the module is +with the ``hide`` attribute (see :ref:`module-attrs`), in which +case the module is never cross-referenced; the contents are always expanded in place in the re-exporting module. -Omitting the export list -~~~~~~~~~~~~~~~~~~~~~~~~ - -If there is no export list in the module, how does Haddock generate -documentation? Well, when the export list is omitted, e.g.: :: - - module Foo where - -this is equivalent to an export list which mentions every entity defined -at the top level in this module, and Haddock treats it in the same way. -Furthermore, the generated documentation will retain the order in which -entities are defined in the module. In this special case the module body -may also include section headings (normally they would be ignored by -Haddock). :: +.. _named-chunks: - module Foo where - - -- * This heading will now appear before foo. - - -- | Documentation for 'foo'. - foo :: Integer - foo = 5 +(Named) Chunks of Documentation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Named chunks of documentation ------------------------------ +It is often desirable to include a chunk of documentation which is not +attached to any particular Haskell declaration, for example, when +giving summary documentation for a group of related definitions (see +:ref:`structure-examples`). In addition to including such documenation +chunks at the top of the file, as part of the +:ref:`module-description`, you can also associate them with +:ref:`section-headings`. -Occasionally it is desirable to include a chunk of documentation which -is not attached to any particular Haskell declaration. There are two -ways to do this: +There are several ways to associate documentation chunks with section +headings, depending on whether you are using an export list or not: -- The documentation can be included in the export list directly, e.g.: :: +- The documentation can be included in the export list directly, by + preceding it with a ``-- |``. For example: :: module Foo ( -- * A section heading @@ -354,11 +573,13 @@ ways to do this: ... ) where + In this case the chunk is not "named". + - If the documentation is large and placing it inline in the export list might bloat the export list and obscure the structure, then it can be given a name and placed out of line in the body of the module. This is achieved with a special form of documentation annotation - “``-- $``”: :: + ``-- $``, which we call a *named chunk*: :: module Foo ( -- * A section heading @@ -371,11 +592,48 @@ ways to do this: -- Here is a large chunk of documentation which may be referred to by -- the name $doc. - The documentation chunk is given a name, which is the sequence of - alphanumeric characters directly after the “``-- $``”, and it may be - referred to by the same name in the export list. + The documentation chunk is given a name of your choice (here + ``doc``), which is the sequence of alphanumeric characters directly + after the ``-- $``, and it may be referred to by the same name in + the export list. Note that named chunks must come *after* any + imports in the module body. + +- If you aren't using an export list, then your only choice is to use + a named chunk with the ``-- $`` syntax. For example: :: + + module Foo where + + -- * A section heading + -- + -- $doc + -- Here is a large chunk of documentation which may be referred to by + -- the name $doc. + + Just like with entity declariations when not using an export list, + named chunks of documentation are associated with the preceding + section header here, or with the implicit top-level documentation + section if there is no preceding section header. + + **Warning**: the form used in the first bullet above, where the + chunk is not named, *does not work* when you aren't using an + export list. For example :: -Hyperlinking and re-exported entities + module Foo where + + -- * A section heading + -- + -- | Some documentation not attached to a particular Haskell entity + + -- | The fooifier. + foo :: ... + + will result in ``Some documentation not ...`` being attached to + *next* entity declaration, here ``foo``, in addition to any other + documentation that next entity already has! + +.. _hyperlinking-re-exported: + +Hyperlinking and Re-Exported Entities ------------------------------------- When Haddock renders a type in the generated documentation, it @@ -455,26 +713,27 @@ The options and module description can be in either order. The following attributes are currently understood by Haddock: -``hide`` ``hide`` +``hide`` Omit this module from the generated documentation, but nevertheless propagate definitions and documentation from within this module to modules that re-export those definitions. -``hide`` ``prune`` +``prune`` Omit definitions that have no documentation annotations from the generated documentation. -``ignore-exports`` ``ignore-exports`` +``ignore-exports`` Ignore the export list. Generate documentation as if the module had no export list - i.e. all the top-level declarations are exported, and section headings may be given in the body of the module. -``not-home`` ``not-home`` +``not-home`` Indicates that the current module should not be considered to be the home module for each entity it exports, unless that entity is not - exported from any other module. See ? for more details. + exported from any other module. See :ref:`hyperlinking-re-exported` + for more details. -``show-extensions`` ``show-extensions`` +``show-extensions`` Indicates that we should render the extensions used in this module in the resulting documentation. This will only render if the output format supports it. If Language is set, it will be shown as well and @@ -482,6 +741,8 @@ The following attributes are currently understood by Haddock: be rendered, including those implied by their more powerful versions. +.. _markup: + Markup ------ @@ -497,7 +758,7 @@ Paragraphs One or more blank lines separates two paragraphs in a documentation comment. -Special characters +Special Characters ~~~~~~~~~~~~~~~~~~ The following characters have special meanings in documentation @@ -514,7 +775,7 @@ Furthermore, the character sequence ``>>>`` has a special meaning at the beginning of a line. To escape it, just prefix the characters in the sequence with a backslash. -Character references +Character References ~~~~~~~~~~~~~~~~~~~~ Although Haskell source files may contain any character from the Unicode @@ -546,7 +807,9 @@ call these “bird tracks”). For example: :: There is an important difference between the two forms of code block: in the bird-track form, the text to the right of the ‘\ ``>``\ ’ is interpreted literally, whereas the ``@...@`` form interprets markup as -normal inside the code block. +normal inside the code block. In particular, ``/`` is markup for italics, +and so e.g. ``@x / y / z@`` renders as ``x`` followed by italic +``y`` with no slashes, followed by ``z``. Examples ~~~~~~~~ @@ -621,7 +884,7 @@ markup is accepted [3]_: ```T'``. because strictly speaking the ````` character should not be used as a left quote, it is a grave accent. -Emphasis, Bold and Monospaced text +Emphasis, Bold and Monospaced Text ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Emphasis may be added by surrounding text with ``/.../``. Other markup @@ -637,9 +900,10 @@ underscore if you need it bold: Monospaced (or typewriter) text is indicated by surrounding it with ``@...@``. Other markup is valid inside a monospaced span: for example ``@'f' a b@`` will hyperlink the identifier ``f`` inside the code -fragment. +fragment, but ``@__FILE__@`` will render ``FILE`` in bold with no +underscores, which may not be what you had in mind. -Linking to modules +Linking to Modules ~~~~~~~~~~~~~~~~~~ Linking to a module is done by surrounding the module name with double @@ -652,7 +916,7 @@ is valid before turning it into a link but unlike with identifiers, whether the module is in scope isn't checked and will always be turned into a link. -Itemized and Enumerated lists +Itemized and Enumerated Lists ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A bulleted item is represented by preceding a paragraph with either @@ -732,7 +996,7 @@ which was unexpected. :: * bar -} -Definition lists +Definition Lists ~~~~~~~~~~~~~~~~ Definition lists are written as follows: :: @@ -833,7 +1097,7 @@ and will be removed in the future. Headings ~~~~~~~~ -Headings inside of comment documentation are possible be preceding them +Headings inside of comment documentation are possible by preceding them with a number of ``=``\ s. From 1 to 6 are accepted. Extra ``=``\ s will be treated as belonging to the text of the heading. Note that it's up to the output format to decide how to render the different levels. :: |