4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
23 [[appendix_contributing_to_documentation]]
24 == Contributing to Documentation
31 :source-language: java
33 The Apache HBase project welcomes contributions to all aspects of the project,
34 including the documentation.
36 In HBase, documentation includes the following areas, and probably some others:
38 * The link:https://hbase.apache.org/book.html[HBase Reference
40 * The link:https://hbase.apache.org/[HBase website]
42 * Command-line utility output and help text
43 * Web UI strings, explicit help text, context-sensitive strings, and others
45 * Comments in source files, configuration files, and others
46 * Localization of any of the above into target languages other than English
48 No matter which area you want to help out with, the first step is almost always
49 to download (typically by cloning the Git repository) and familiarize yourself
50 with the HBase source code. For information on downloading and building the source,
51 see <<developer,developer>>.
53 === Contributing to Documentation or Other Strings
55 If you spot an error in a string in a UI, utility, script, log message, or elsewhere,
56 or you think something could be made more clear, or you think text needs to be added
57 where it doesn't currently exist, the first step is to file a JIRA. Be sure to set
58 the component to `Documentation` in addition to any other involved components. Most
59 components have one or more default owners, who monitor new issues which come into
60 those queues. Regardless of whether you feel able to fix the bug, you should still
61 file bugs where you see them.
63 If you want to try your hand at fixing your newly-filed bug, assign it to yourself.
64 You will need to clone the HBase Git repository to your local system and work on
65 the issue there. When you have developed a potential fix, submit it for review.
66 If it addresses the issue and is seen as an improvement, one of the HBase committers
67 will commit it to one or more branches, as appropriate.
69 [[submit_doc_patch_procedure]]
70 .Procedure: Suggested Work flow for Submitting Patches
71 This procedure goes into more detail than Git pros will need, but is included
72 in this appendix so that people unfamiliar with Git can feel confident contributing
73 to HBase while they learn.
75 . If you have not already done so, clone the Git repository locally.
76 You only need to do this once.
77 . Fairly often, pull remote changes into your local repository by using the
78 `git pull` command, while your tracking branch is checked out.
79 . For each issue you work on, create a new branch.
80 One convention that works well for naming the branches is to name a given branch
81 the same as the JIRA it relates to:
84 $ git checkout -b HBASE-123456
87 . Make your suggested changes on your branch, committing your changes to your
88 local repository often. If you need to switch to working on a different issue,
89 remember to check out the appropriate branch.
90 . When you are ready to submit your patch, first be sure that HBase builds cleanly
91 and behaves as expected in your modified branch.
92 . If you have made documentation changes, be sure the documentation and website
93 builds by running `mvn clean site`.
94 . If it takes you several days or weeks to implement your fix, or you know that
95 the area of the code you are working in has had a lot of changes lately, make
96 sure you rebase your branch against the remote master and take care of any conflicts
97 before submitting your patch.
100 $ git checkout HBASE-123456
101 $ git rebase origin/master
104 . Generate your patch against the remote master. Run the following command from
105 the top level of your git repository (usually called `hbase`):
108 $ git format-patch --stdout origin/master > HBASE-123456.patch
111 The name of the patch should contain the JIRA ID.
112 . Look over the patch file to be sure that you did not change any additional files
113 by accident and that there are no other surprises.
114 . When you are satisfied, attach the patch to the JIRA and click the
115 btn:[Patch Available] button. A reviewer will review your patch.
116 . If you need to submit a new version of the patch, leave the old one on the
117 JIRA and add a version number to the name of the new patch.
118 . After a change has been committed, there is no need to keep your local branch around.
120 === Editing the HBase Website
122 The source for the HBase website is in the HBase source, in the _src/site/_ directory.
123 Within this directory, source for the individual pages is in the _xdocs/_ directory,
124 and images referenced in those pages are in the _resources/images/_ directory.
125 This directory also stores images used in the HBase Reference Guide.
127 The website's pages are written in an HTML-like XML dialect called xdoc, which
128 has a reference guide at
129 https://maven.apache.org/archives/maven-1.x/plugins/xdoc/reference/xdocs.html.
130 You can edit these files in a plain-text editor, an IDE, or an XML editor such
131 as XML Mind XML Editor (XXE) or Oxygen XML Author.
133 To preview your changes, build the website using the `mvn clean site -DskipTests`
134 command. The HTML output resides in the _target/site/_ directory.
135 When you are satisfied with your changes, follow the procedure in
136 <<submit_doc_patch_procedure,submit doc patch procedure>> to submit your patch.
139 === Publishing the HBase Website and Documentation
141 HBase uses the ASF's `gitpubsub` mechanism. A Jenkins job runs the
142 `dev-support/jenkins-scripts/generate-hbase-website.sh` script, which runs the
143 `mvn clean site site:stage` against the `master` branch of the `hbase`
144 repository and commits the built artifacts to the `asf-site` branch of the
145 `hbase-site` repository. When the commit is pushed, the website is redeployed
146 automatically. If the script encounters an error, an email is sent to the
147 developer mailing list. You can run the script manually or examine it to see the
150 [[website_check_links]]
151 === Checking the HBase Website for Broken Links
153 A Jenkins job runs periodically to check HBase website for broken links, using
154 the `dev-support/jenkins-scripts/check-website-links.sh` script. This script
155 uses a tool called `linklint` to check for bad links and create a report. If
156 broken links are found, an email is sent to the developer mailing list. You can
157 run the script manually or examine it to see the steps involved.
159 === HBase Reference Guide Style Guide and Cheat Sheet
161 The HBase Reference Guide is written in Asciidoc and built using link:http://asciidoctor.org[AsciiDoctor].
162 The following cheat sheet is included for your reference. More nuanced and comprehensive documentation
163 is available at http://asciidoctor.org/docs/user-manual/.
165 .AsciiDoc Cheat Sheet
166 [cols="1,1,a",options="header"]
168 | Element Type | Desired Rendering | How to do it
169 | A paragraph | a paragraph | Just type some text with a blank line at the top and bottom.
170 | Add line breaks within a paragraph without adding blank lines | Manual line breaks | This will break + at the plus sign. Or prefix the whole paragraph with a line containing '[%hardbreaks]'
171 | Give a title to anything | Colored italic bold differently-sized text | .MyTitle (no space between the period and the words) on the line before the thing to be titled
172 | In-Line Code or commands | monospace | \`text`
173 | In-line literal content (things to be typed exactly as shown) | bold mono | \*\`typethis`*
174 | In-line replaceable content (things to substitute with your own values) | bold italic mono | \*\_typesomething_*
175 | Code blocks with highlighting | monospace, highlighted, preserve space |
183 | Code block included from a separate file | included just as though it were part of the main file |
187 include\::path/to/app.rb[]
190 | Include only part of a separate file | Similar to Javadoc
191 | See http://asciidoctor.org/docs/user-manual/#by-tagged-regions
192 | Filenames, directory names, new terms | italic | \_hbase-default.xml_
193 | External naked URLs | A link with the URL as link text |
195 link:http://www.google.com
198 | External URLs with text | A link with arbitrary link text |
200 link:http://www.google.com[Google]
203 | Create an internal anchor to cross-reference | not rendered |
207 | Cross-reference an existing anchor using its default title| an internal hyperlink using the element title if available, otherwise using the anchor name |
211 | Cross-reference an existing anchor using custom text | an internal hyperlink using arbitrary text |
213 <<anchor_name,Anchor Text>>
215 | A block image | The image with alt text |
217 image::sunset.jpg[Alt Text]
219 (put the image in the src/site/resources/images directory)
220 | An inline image | The image with alt text, as part of the text flow |
222 image:sunset.jpg [Alt Text]
225 | Link to a remote image | show an image hosted elsewhere |
227 image::http://inkscape.org/doc/examples/tux.svg[Tux,250,350]
230 | Add dimensions or a URL to the image | depends | inside the brackets after the alt text, specify width, height and/or link="http://my_link.com"
231 | A footnote | subscript link which takes you to the footnote |
233 Some text.footnote:[The footnote text.]
235 | A note or warning with no title | The admonition image followed by the admonition |
241 WARNING:My warning here
243 | A complex note | The note has a title and/or multiple paragraphs and/or code blocks or lists, etc |
248 Here is the note text. Everything until the second set of four equals signs is part of the note.
254 | Bullet lists | bullet lists |
258 (see http://asciidoctor.org/docs/user-manual/#unordered-lists)
259 | Numbered lists | numbered list |
263 (see http://asciidoctor.org/docs/user-manual/#ordered-lists)
264 | Checklists | Checked or unchecked boxes |
273 | Multiple levels of lists | bulleted or numbered or combo |
275 . Numbered (1), at top level
276 * Bullet (2), nested under 1
277 * Bullet (3), nested under 1
278 . Numbered (4), at top level
279 * Bullet (5), nested under 4
280 ** Bullet (6), nested under 5
281 - [x] Checked (7), at top level
283 | Labelled lists / variablelists | a list item title or summary followed by content |
290 | Sidebars, quotes, or other blocks of text
291 | a block of text, formatted differently from the default
292 | Delimited using different delimiters,
293 see http://asciidoctor.org/docs/user-manual/#built-in-blocks-summary.
294 Some of the examples above use delimiters like \...., ----,====.
298 This is an example block.
303 This is a source block.
308 This is a note block.
313 This is a quote block.
317 If you want to insert literal Asciidoc content that keeps being interpreted, when in doubt, use eight dots as the delimiter at the top and bottom.
318 | Nested Sections | chapter, section, sub-section, etc |
320 = Book (or chapter if the chapter can be built alone, see the leveloffset info below)
322 == Chapter (or section if the chapter is standalone)
324 === Section (or subsection, etc)
329 and so on up to 6 levels (think carefully about going deeper than 4 levels, maybe you can just titled paragraphs or lists instead). Note that you can include a book inside another book by adding the `:leveloffset:+1` macro directive directly before your include, and resetting it to 0 directly after. See the _book.adoc_ source for examples, as this is how this guide handles chapters. *Don't do it for prefaces, glossaries, appendixes, or other special types of chapters.*
331 | Include one file from another | Content is included as though it were inline |
334 include::[/path/to/file.adoc]
337 For plenty of examples. see _book.adoc_.
338 | A table | a table | See http://asciidoctor.org/docs/user-manual/#tables. Generally rows are separated by newlines and columns by pipes
339 | Comment out a single line | A line is skipped during rendering |
340 `+//+ This line won't show up`
341 | Comment out a block | A section of the file is skipped during rendering |
344 Nothing between the slashes will show up.
347 | Highlight text for review | text shows up with yellow background |
349 Test between #hash marks# is highlighted yellow.
354 === Auto-Generated Content
356 Some parts of the HBase Reference Guide, most notably <<config.files,config.files>>,
357 are generated automatically, so that this area of the documentation stays in
358 sync with the code. This is done by means of an XSLT transform, which you can examine
359 in the source at _src/main/xslt/configuration_to_asciidoc_chapter.xsl_. This
360 transforms the _hbase-common/src/main/resources/hbase-default.xml_ file into an
361 Asciidoc output which can be included in the Reference Guide.
363 Sometimes, it is necessary to add configuration parameters or modify their descriptions.
364 Make the modifications to the source file, and they will be included in the
365 Reference Guide when it is rebuilt.
367 It is possible that other types of content can and will be automatically generated
368 from HBase source files in the future.
370 === Images in the HBase Reference Guide
372 You can include images in the HBase Reference Guide. It is important to include
373 an image title if possible, and alternate text always. This allows screen readers
374 to navigate to the image and also provides alternative text for the image.
375 The following is an example of an image with a title and alternate text. Notice
381 image::sunset.jpg[Alt Text]
384 Here is an example of an inline image with alternate text. Notice the single colon.
385 Inline images cannot have titles. They are generally small images like GUI buttons.
389 image:sunset.jpg[Alt Text]
392 When doing a local build, save the image to the _src/site/resources/images/_ directory.
393 When you link to the image, do not include the directory portion of the path.
394 The image will be copied to the appropriate target location during the build of the output.
396 When you submit a patch which includes adding an image to the HBase Reference Guide,
397 attach the image to the JIRA. If the committer asks where the image should be
398 committed, it should go into the above directory.
400 === Adding a New Chapter to the HBase Reference Guide
402 If you want to add a new chapter to the HBase Reference Guide, the easiest way
403 is to copy an existing chapter file, rename it, and change the ID (in double
404 brackets) and title. Chapters are located in the _src/main/asciidoc/_chapters/_
407 Delete the existing content and create the new content. Then open the
408 _src/main/asciidoc/book.adoc_ file, which is the main file for the HBase Reference
409 Guide, and copy an existing `include` element to include your new chapter in the
410 appropriate location. Be sure to add your new file to your Git repository before
413 When in doubt, check to see how other files have been included.
415 === Common Documentation Issues
417 The following documentation issues come up often. Some of these are preferences,
418 but others can create mysterious build errors or other problems.
421 Isolate Changes for Easy Diff Review.::
422 Be careful with pretty-printing or re-formatting an entire XML file, even if
423 the formatting has degraded over time. If you need to reformat a file, do that
424 in a separate JIRA where you do not change any content. Be careful because some
425 XML editors do a bulk-reformat when you open a new file, especially if you use
426 GUI mode in the editor.
428 Syntax Highlighting::
429 The HBase Reference Guide uses `coderay` for syntax highlighting. To enable
430 syntax highlighting for a given code listing, use the following type of syntax:
439 Several syntax types are supported. The most interesting ones for the HBase
440 Reference Guide are `java`, `xml`, `sql`, and `bash`.