atom_editor.adoc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. = Atom Editor for Wiki Editing
  2. :author: mitm
  3. :revnumber: 2.0
  4. :revdate: 2020/07/12
  5. Contributing to the Wiki is now easier than it ever has been. Using the Atom editor will give you an easy to use interface that is cross-platform, has code completion, syntax highlighting, instant AsciiDoctor page previewing, with an integrated GitHub client. The only thing it doesn't do is write the page for you. You can use it in conjunction with the link:https://git-scm.com/[Git] command line interface.
  6. == Definitions
  7. * (CLI) - Git Command Line Interface
  8. * (GWI) - GitHub Web Interface
  9. == Prerequisites
  10. . Have a link:https://github.com/[GitHub account].
  11. . Are a Wiki project member.
  12. If you are not a member, you fork the repository into your GitHub account and issue "`pull`" requests to the Wiki repository from there.
  13. To fork the Wiki repository into your GitHub Account:
  14. . Navigate to link:https://github.com/jMonkeyEngine/wiki[https://github.com/jMonkeyEngine/wiki].
  15. . In the menu at the top of the page, select the icon:code-fork[]*Fork* button.
  16. == Downloading the Sources
  17. . Install link:https://git-scm.com/[Git].
  18. . Download and install the Atom editor - https://atom.io/
  19. . After installation is complete, you can customize the editor by selecting the `Choose A Theme` panel followed by the btn:[Theme Picker] button.
  20. . Once you are satisfied with the customization of the editor, you will need to add several packages to make Atom AsciiDoctor compatible. Package installation is painless.
  21. .. From the `Install A Package` panel, select the btn:[Open Installer] button, or select `menu:Packages[Settings View>Install Packages/Themes]` from the file header.
  22. .. Enter "`asciidoc`" in the search box and press the btn:[Packages] button.
  23. +
  24. .Add these packages:
  25. *** *language-asciidoc* +
  26. *** *asciidoc-preview* +
  27. *** *autocomplete-asciidoc*
  28. +
  29. TIP: You can add more GitHub controls to the editor by adding the package `*git-plus*`.
  30. To edit the Wiki you will need to clone the wiki repository.
  31. . From the `Command Palette` (kbd:[ctrl]+kbd:[shift] +kbd:[P] or `menu:Packages[Command Palette>Toggle]`), enter "`git`" into the search box.
  32. . Select btn:[GitHub: Clone].
  33. +
  34. --
  35. .Members
  36. Paste the wiki the +++<abbr title="Uniform Resource Locator">URL</abbr>+++ into the `Clone from` box.
  37. [source]
  38. ----
  39. https://github.com/jMonkeyEngine/wiki
  40. ----
  41. .Non-Members
  42. Paste your forks +++<abbr title="Uniform Resource Locator">URL</abbr>+++ into the `Clone from` box.
  43. --
  44. The `To directory` will automatically update when you do.
  45. . When you're ready, press the btn:[Clone] button.
  46. +
  47. The clone will take some time due to the size of the Wiki. Once cloned, a new `Project` tab will open on the left, and the `Git` and `GitHub Preview` tabs will open to the right. If they don't, you can open the Git tab using kbd:[ctrl]+kbd:[shift]+kbd:[9] and the GitHub Preview tab using kbd:[ctrl]+kbd:[shift]+kbd:[8]. Alternatively, you can navigate the `menu:Packages[GitHub]` menu. You will also notice in the lower right corner, on the `Status Bar`, you now have your GitHub control.
  48. . Before you can commit any changes to the Wiki, you must configure at least the user.email and user.name variables for Git. You can do this via Git Bash, or manually, by following one of these instructions.
  49. * Git Bash: link:https://help.github.com/articles/setting-your-commit-email-address-in-git/[Setting your commit email address in Git]
  50. * Manually: link:https://help.github.com/articles/setting-your-commit-email-address-on-github/[Set your commit email address on GitHub]
  51. .. Open your `.gitconfig` file (located in USER_HOME) and add:
  52. +
  53. [source]
  54. ----
  55. [user]
  56. name = yourname
  57. email = youremail
  58. ----
  59. .. To maintain your privacy, setup your email settings in your GitHub account and use the `users.noreply.github.com` email address.
  60. . Lastly, you will need to create a GitHub token. Follow the directions in the popup to enter the token.
  61. == Source Structure
  62. All documents live in the `docs/modules` directory. Each link:https://docs.antora.org/antora/2.3/named-module-directory/[named] and link:https://docs.antora.org/antora/2.3/root-module-directory/[ROOT] module contain a defined link:https://docs.antora.org/antora/2.3/family-directories/[family] set of directories that hold all content. Select an appropriate module and family directory to store your new page, image, partial, example or attachement.
  63. When you edit a Wiki page, the Git tab will show any unstaged changes. When you're done making changes, you stage any or all changes, write your commit message, commit, and then push the changes.
  64. You can preview your documents by selecting the document and using the keyboard shortcut kbd:[ctrl]+kbd:[shift]+kbd:[A] or by using the File header menu menu:Packages[AsciiDoc Preview>Toggle Preview].
  65. == Updating Local Wiki Copies
  66. It's a good idea to update your local copy of the Wiki prior to committing any changes.
  67. .Members
  68. Update your local copy of the Wiki from the Atom Editor or (CLI) by issuing a `pull` command prior to Commit/Push.
  69. .Non-Members
  70. Update your local copy of the Wiki by:
  71. . Issuing a `pull` request from your forked repository using the (GWI).
  72. .. Go to your version of the repository on GitHub.
  73. .. Click the btn:[New Pull Request] button at the top.
  74. +
  75. NOTE: The Wiki repository will be on the left and your repository will be on the right.
  76. .. Click the btn:[Base] button on the left and from the drop down list select your forked repository.
  77. .. Click the "`compare across forks`" link.
  78. .. Click the btn:[Head Fork] button and from the drop down list select the Wiki repository.
  79. .. If the repositories are not identical, there will be green button btn:[Create pull request]. Click it to update your repository.
  80. . Update your local copy by doing a `pull` request in the Atom Editor or (CLI).
  81. include::partial$non-member-important.adoc[]
  82. == Pushing Changes
  83. .Members
  84. As a member, issue a `push` command from the Atom Editor or (CLI).
  85. .Non-Members
  86. To submit changes to the Wiki repository, after pushing them to your fork, from the (GWI):
  87. . Go to your version of the Wiki repository on GitHub.
  88. .. Click the btn:[New Pull Request] button at the top.
  89. ... Note that the jMonkeyEngine repository will be on the left and your repository will be on the right.
  90. .. Click the green button btn:[Create pull request]. Give a succinct and informative title, in the comment field give a short explanation of the changes and click the green button btn:[Create pull request] again.
  91. include::partial$non-member-important.adoc[]
  92. == Creating pages
  93. You create link:https://docs.antora.org/antora/2.3/page/standard-page/[pages] by saving a file with the `.adoc` extension. The first line of a page must contain a title.
  94. ```
  95. = My Title Goes here
  96. ```
  97. Everything after the title line, up to the first empty new line, is called the `header` of the document. This is where you set optional link:https://docs.antora.org/antora/2.3/page/attributes/[attributes] for your documents.
  98. The Antora manual has a very quick to read link:https://docs.antora.org/antora/2.3/asciidoc/asciidoc/[Primer] that will get you up to speed on writing pages fast.
  99. Documents rely heavily on using `References` to link to other content in the same or different modules. This is a critical part of writing your documents. Knowing how to link to other content. There are two types of "`references`", link:https://docs.antora.org/antora/2.3/page/page-id/[Cross References] and link:https://docs.antora.org/antora/2.3/asciidoc/in-page-xref/[Internal Cross Reference]. A `Cross References` links to a link:https://docs.antora.org/antora/2.3/page/module-and-page-xrefs/[*page*] in the same or different module, an `Internal Cross Reference` links to *elements* inside a document located either in the same page, same module or a different module.
  100. The snippets page contains various forms these `Cross References` that make linking easier.
  101. See also:
  102. * link:https://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual]
  103. * <<emoji.adoc#how-to-use-emoji-in-the-wiki,How to use emoji in the wiki>>
  104. == Atom Snippets
  105. [quote, Atom Flight Manual: Snippets]
  106. Snippets are an incredibly powerful way to quickly generate commonly needed code syntax from a shortcut.
  107. One advantage of using Atom as an editor for the Wiki comes from the use of link:http://flight-manual.atom.io/using-atom/sections/snippets/[Snippets]. You can see a list of available snippets for your document by using the `Command Palette` (kbd:[ctrl]+kbd:[shift] +kbd:[P] or `menu:Packages[Command Palette>Toggle]`). Enter "`snippets`" into the search box and select btn:[Snippets: Available].
  108. The Atom AsciiDoc packages add great functionality to the editor, but they do not cover everything that's possible when using AsciiDoctor syntax. You can customize the editor even further by adding your own snippets. I will get you started with your first snippet. Simply copy and paste the code below into your "`snippets.cson`" file and save. You can locate the file under menu:File[Snippets].
  109. [source]
  110. ----
  111. '.source.asciidoc':
  112. 'Cross reference internal element, same page':
  113. 'prefix': 'xrefI'
  114. 'body': '<<${1:reference-a-section-in-the-same-page},${2:custom label text}>>'
  115. ----
  116. Thereafter, just start typing `xrefI` and select it from the popup menu or hit kbd:[Tab] with it highlighted in the menu, to insert an `Internal Cross Reference` link. You can then use the kbd:[Tab] key to cycle through each tab stop and enter the appropriate data for that link.
  117. TIP: A kbd:[Tab] key in the above code is set by wraping any text to be tabbed with the `${1:}` syntax, where the integer represents the tab order. When cycling through tabs, you can backspace them to remove multiple choice tab content or just enter the text for single selection content.
  118. You can help the jMonkey community by adding new snippets. Use your editor and edit the xref:atom_snippets.adoc[Atom Snippets] document. Make sure to announce any proposed changes on the link:https://hub.jmonkeyengine.org/[jMonkeyEngine Forum] under the topic "`Documentation`" first so others are aware and can test out your proposed change.
  119. '''
  120. Next steps,
  121. * Read the Wiki link:https://github.com/jMonkeyEngine/wiki[README] page.
  122. * Add link:https://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual] to your favorites.
  123. * Add link:https://docs.antora.org[Antora Docs] to your favorites.
  124. * Add the link:https://atom.io/docs[Atom Docs] to your favorites.
  125. * Add the link:http://flight-manual.atom.io/[Atom Flight Manual] to your favorites.
  126. * Add the link:http://rogerdudler.github.io/git-guide/[git - the simple guide] to your favorites.
  127. * Start contributing.