Back to home page

EIC code displayed by LXR

 
 

    


Warning, /jana2/docs/development/documentation.md is written in an unsupported language. File is not indexed.

0001 # Documentation
0002 
0003 The website documentation is automatically generated via GitHub Actions 
0004 [.github/workflows/documentation.yml](https://github.com/JeffersonLab/JANA2/blob/master/.github/workflows/documentation.yml)
0005  and uploaded to GitHub Pages. 
0006 
0007 - The C++ reference part is generated by [Doxygen](https://www.doxygen.nl)
0008 - The main website is powered by [Docsify](https://docsify.js.org/)
0009 
0010 
0011 ## Docsify
0012 
0013 Docsify is an open-source tool for generating documentation websites directly from Markdown files. 
0014 It dynamically converts Markdown files into a website without the need for a build process.
0015 
0016 - Docsify uses GFM (Git Flawored Markdown) with additional features such as possibility to include one document in another
0017 - [Docsify markdown features](https://docsify.js.org/#/helpers?id=important-content)
0018 - [Full markdown typography used in JANA2 theme](https://jhildenbiddle.github.io/docsify-themeable/#/markdown)
0019 
0020 
0021 
0022 ### Running on local machine
0023 
0024 To preview the documentation on local machine, you can open `./docs` folder in any server application. 
0025 Here is a python one-liner that makes the site running at `localhost:3000`
0026 
0027 ```bash
0028 # assuming current working directoy is JANA2/docs 
0029 python3 -m http.server 3000
0030 ```
0031 
0032 > On windows machines you may have to use `python` instead of `python3`
0033 
0034 
0035 
0036 ### Adding content
0037 
0038 Any markdown file added to docs folder will be automatically rendered by docsify if correct link is given. 
0039 A file `text.md` is displayed by a link `<domain>#/text.md`
0040 
0041 E.g. a file:
0042 
0043 ``` 
0044 JANA2/docs/jana1to2/developers-transition-guide.md
0045 ```
0046 
0047 Is accessible as:
0048 
0049 ```
0050 # localhost (if run by server above): 
0051 http://localhost:3000/#/jana1to2/developers-transition-guide.md
0052 
0053 # GitHub pages when merged into master
0054 https://jeffersonlab.github.io/JANA2/#/jana1to2/developers-transition-guide.md
0055 ```
0056 
0057 ### Menus
0058 
0059 While new content may be seen right away, it is not automatically getting added to the side menu. 
0060 To add links no new pages to left side menu, one has to edit `_sidebar.md`, which is pretty self explanatory. 
0061 
0062 `_coverpage.md` is responsible for the cover page content (with gnomes as of 2024). 
0063 
0064 
0065 ### Writing documentation
0066 
0067 Here are couple recommendations to the documentation writing: 
0068 
0069 
0070 - Use subdirectories for a group of documents and topics. Such as `howto` or `jana1to2`
0071 - Use low case with dashes `low-case-with-dashes.md` file names style. It is considered to be better for search engine parsers. 
0072 - Put pictures into corresponding subfolder or if a picture has a global context, to docs/_media folder. Create _media subfolders as needed. 
0073 - Always follow the document purpose. Think if document falls into `How-to`, `Tutorial`,  `Explanation/documentation` or `Reference guide`. 
0074   Don't mix them together (even if sometimes adding a bit of theory in tutorial seems tempting - don't do it!)
0075   More about it in [the documentation theory here](https://docs.divio.com/documentation-system/)
0076 
0077 
0078 
0079 
0080 The main documentation is powered by the Docsify JavaScript library https://docsify.js.org/#/
0081 
0082 [Available plugins](https://docsify-theme-github.vercel.app/#/awesome?id=plugins):
0083 
0084 - Example panels [github](https://github.com/VagnerDomingues/docsify-example-panels) [demo](https://vagnerdomingues.github.io/docsify-example-panels/#/)
0085 - Docsify Fontawesome [github](https://github.com/erickjx/docsify-fontawesome) [Fontawesome](https://fontawesome.com/)
0086 - Select documentation version [github](https://github.com/UliGall/docsify-versioned-plugin)
0087 - Docsify themebable [github](https://jhildenbiddle.github.io/docsify-themeable/#/)
0088 - Theme switcher [github](https://github.com/
0089 - Marked is used as markdown [Marked](https://github.com/markedjs/marked)
0090 
0091 
0092 ## Doxygen
0093 
0094 Doxygen is a widely used documentation generation tool for C++ projects. 
0095 It parses the source code and accompanying comments, formatted according to Doxygen's configurable markup, 
0096 producing documentation in various output formats such as HTML, XML, and LaTeX.
0097 
0098 ```bash
0099 # Assuming cwd is JANA2/ - repository root folder
0100 cd docs
0101 doxygen Doxyfile
0102 ```
0103 
0104 The command will generate documentation in `doxygen_build` folder so then:
0105 
0106 - The output is saved to `docs/doxygen_build`
0107 - html web site: `docs/doxygen_build/html`
0108 - xml: `docs/doxygen_build/xml`
0109 - latex: `docs/doxygen_build/latex`
0110 
0111 One can test the generated website: 
0112 
0113 ```bash
0114 # assuming cwd is JANA2/docs 
0115 python3 -m http.server -d doxygen_build/html/ 8000
0116 ```
0117 
0118 To add doxygen links and some other fine tuning of doxygen page look, 
0119 header and footer files were generated. If doxygen will ever change the template, 
0120 those probably has to be regenerated: 
0121 
0122 ```
0123 doxygen -w html doxygen_header.html doxygen_footer.html doxygen_stylesheet.css
0124 ```
0125 
0126 Add this to doxygen footer before `</body>` closing tag: 
0127 
0128 ```html
0129 <!-- JANA2 custom footer addition -->
0130 <script type="text/javascript">
0131   $(document).ready(function() {
0132       let navHeader = '<li><a href="https://github.com/JeffersonLab/JANA2" target="_blank">Project GitHUB</a></li>';
0133       // Append it to the navigation div or another appropriate place in the menu
0134       $('#main-menu').append(navHeader);
0135   });
0136 </script>
0137 <!-- END JANA2 custom footer addition -->
0138 ```
0139