git.iko.soy/typeable/pandoc
on sable help sign in
typeable/pandoc/CONTRIBUTING.md
181 lines 7.3 kB history raw
1Contributing to pandoc
2======================
4Found a bug?
5------------
7Bug reports are welcome! Please report all bugs on pandoc's github
8[issue tracker].
10Before you submit a bug report, search the (open *and* closed) issues to make
11sure the issue hasn't come up before. Also, check the [User's Guide] and [FAQs]
12for anything relevant.
14Make sure you can reproduce the bug with the latest released version of pandoc
15(or, even better, the development version).
17Your report should give detailed instructions for how to reproduce the problem,
18including
20 * the exact command line used
21 * the exact input used
22 * the output received
23 * the output you expected instead
25A small test case (just a few lines) is ideal. If your input is large,
26try to whittle it down to the minimum necessary to illustrate the problem.
28Have an idea for a new feature?
29-------------------------------
31First, search [pandoc-discuss] and the issue tracker (both open and closed
32issues) to make sure that the idea has not been discussed before.
34Explain the rationale for the feature you're requesting. Why would this
35feature be useful? Consider also any possible drawbacks, including backwards
36compatibility, new library dependencies, and performance issues.
38It is best to discuss a potential new feature on [pandoc-discuss]
39before opening an issue.
41Patches and pull requests
42-------------------------
44Patches and pull requests are welcome. Before you put time into a nontrivial
45patch, it is a good idea to discuss it on [pandoc-discuss], especially if it is
46for a new feature (rather than fixing a bug).
48Please follow these guidelines:
501. Each patch (commit) should make a single logical change (fix a bug, add
51 a feature, clean up some code, add documentation). Everything
52 related to that change should be included (including tests and
53 documentation), and nothing unrelated should be included.
552. The first line of the commit message should be a short description
56 of the whole commit (ideally <= 50 characters). Then there should
57 be a blank line, followed by a more detailed description of the
58 change.
603. Follow the stylistic conventions you find in the existing
61 pandoc code. Use spaces, not tabs, and wrap code to 80 columns.
62 Always include type signatures for top-level functions.
644. Your code should compile without warnings (`-Wall` clean).
665. Run the tests to make sure your code does not introduce new bugs.
67 (See below under [Tests](#tests).) All tests should pass.
696. It is a good idea to add test cases for the bug you are fixing. (See
70 below under [Tests](#tests).) If you are adding a new writer or reader,
71 you must include tests.
737. If you are adding a new feature, include updates to the README.
758. All code must be released under the general license governing pandoc
76 (GPL v2).
789. It is better not to introduce new dependencies. Dependencies on
79 external C libraries should especially be avoided.
81Tests
82-----
84Tests can be run as follows:
86 cabal configure --enable-tests
87 cabal build
88 cabal test
90The test program is `tests/test-pandoc.hs`.
92Benchmarks can be enabled by passing the `--enable-benchmarks` flag
93to `cabal configure`, and run using `cabal bench`.
95The code
96--------
98Pandoc has a publicly accessible git repository on
99github: <http://github.com/jgm/pandoc>. To get a local copy of the source:
101 git clone git://github.com/jgm/pandoc.git
103Note: after cloning the repository (and in the future after pulling from it),
104you should do
106 git submodule update --init
108to pull in changes to the templates (`data/templates/`). You can automate this
109by creating a file `.git/hooks/post-merge` with the contents:
111 #!/bin/sh
112 git submodule update --init
114and making it executable:
116 chmod +x .git/hooks/post-merge
118The source for the main pandoc program is `pandoc.hs`. The source for
119the pandoc library is in `src/`, the source for the tests is in
120`tests/`, and the source for the benchmarks is in `benchmark/`.
122The modules `Text.Pandoc.Definition`, `Text.Pandoc.Builder`, and
123`Text.Pandoc.Generics` are in a separate library `pandoc-types`. The code can
124be found in a <http://github.com/jgm/pandoc-types>.
126To build pandoc, you will need a working installation of the
127[Haskell platform].
129The library is structured as follows:
131 - `Text.Pandoc` is a top-level module that exports what is needed
132 by most users of the library. Any patches that add new readers
133 or writers will need to make changes here, too.
134 - `Text.Pandoc.Definition` (in `pandoc-types`) defines the types
135 used for representing a pandoc document.
136 - `Text.Pandoc.Builder` (in `pandoc-types`) provides functions for
137 building pandoc documents programatically.
138 - `Text.Pandoc.Generics` (in `pandoc-types`) provides functions allowing
139 you to promote functions that operate on parts of pandoc documents
140 to functions that operate on whole pandoc documents, walking the
141 tree automatically.
142 - `Text.Pandoc.Readers.*` are the readers, and `Text.Pandoc.Writers.*`
143 are the writers.
144 - `Text.Pandoc.Biblio` is a utility module for formatting citations
145 using citeproc-hs.
146 - `Text.Pandoc.Data` is used to embed data files when the `embed_data_files`
147 cabal flag is used. It is generated from `src/Text/Pandoc/Data.hsb` using
148 the preprocessor [hsb2hs].
149 - `Text.Pandoc.Highlighting` contains the interface to the
150 highlighting-kate library, which is used for code syntax highlighting.
151 - `Text.Pandoc.ImageSize` is a utility module containing functions for
152 calculating image sizes from the contents of image files.
153 - `Text.Pandoc.MIME` contains functions for associating MIME types
154 with extensions.
155 - `Text.Pandoc.Options` defines reader and writer options.
156 - `Text.Pandoc.PDF` contains functions for producing a PDF from a
157 LaTeX source.
158 - `Text.Pandoc.Parsing` contains parsing functions used in multiple readers.
159 - `Text.Pandoc.Pretty` is a pretty-printing library specialized to
160 the needs of pandoc.
161 - `Text.Pandoc.SelfContained` contains functions for making an HTML
162 file "self-contained," by importing remotely linked images, CSS,
163 and javascript and turning them into `data:` URLs.
164 - `Text.Pandoc.Shared` is a grab-bag of shared utility functions.
165 - `Text.Pandoc.Writers.Shared` contains utilities used in writers only.
166 - `Text.Pandoc.Slides` contains functions for splitting a markdown document
167 into slides, using the conventions described in the README.
168 - `Text.Pandoc.Templates` defines pandoc's templating system.
169 - `Text.Pandoc.UTF8` contains functions for converting text to and from
170 UTF8 bytestrings (strict and lazy).
171 - `Text.Pandoc.Asciify` contains functions to derive ascii versions of
172 identifiers that use accented characters.
173 - `Text.Pandoc.UUID` contains functions for generating UUIDs.
174 - `Text.Pandoc.XML` contains functions for formatting XML.
176[pandoc-discuss]: http://groups.google.com/group/pandoc-discuss
177[issue tracker]: https://github.com/jgm/pandoc/issues
178[User's Guide]: http://johnmacfarlane.net/pandoc/README.html
179[FAQs]: http://johnmacfarlane.net/pandoc/faqs.html
180[Haskell platform]: http://www.haskell.org/platform/
181[hsb2hs]: http://hackage.haskell.org/package/hsb2hs