Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program documentation: md vs dox #29

Open
jgvictores opened this issue Sep 21, 2017 · 28 comments
Open

Program documentation: md vs dox #29

jgvictores opened this issue Sep 21, 2017 · 28 comments

Comments

@jgvictores
Copy link
Member

Program documentation:

  1. dox : most repos
  2. md : look at roboticslab-uc3m/tools@89578f3
@PeterBowman
Copy link
Member

Do you by chance mean that those huge chunks of how-to-use comments like this (usually located in the app's main.cpp) should be moved to a .md file?

@jgvictores
Copy link
Member Author

I refer to that type of movement, but rather than a suggestion, it is a question.

IMHO, the pros are:

  1. dox: autogeneration of link pages (avoiding hard-coded to master/develop like here).
  2. md: online rendering, and perhaps more visibility in general.

What is your opinion? Maybe there is an option to link md via relative paths?

@RaulFdzbis
Copy link
Member

RaulFdzbis commented Sep 27, 2017

Personally I prefer md because of these reasons:

  1. It's integrated in github (This give md. more visibility and familiar use, you are using github all the time, dont need to change between github-doxygen)
  2. In my personal experience most of the repos i have found have most of it's documentation in md.
  3. I think maybe doxygen is too program oriented, so its harder to read for those people that are not familiar with programming.

On the other hand, it has some cons:

  1. Can get messy if the documentation is too big (i don't think right now is a problem for us, also there are better options for big documentations like gitbook)
  2. Harder to maintain, at the end md uses something similar to absolute paths.
  3. We use doxygen in most of our repos.

@David-Estevez
Copy link

My personal opinion: I only like Doxygen for documenting APIs, classes, etc. For any other doc info I prefer markdown because of the simplexity of the syntax yet beautiful syntax. :)

@PeterBowman
Copy link
Member

Sorry for my late response. I'm getting increasingly convinced that MD might be a nice replacement for long, unwieldy Doxygen doc files. We have a bunch of them scattered around asibot-main (see doc.dox). The syntax is rather obscure and lacks GitHub editor support (which is essentially a WYSIWYG markdown text editor).

dox: autogeneration of link pages (avoiding hard-coded to master/develop like here).

@jgvictores I think that relpaths could work there, try programs/openraveToStl (or /programs/openraveToStl, or ./programs/openraveToStl).

@PeterBowman
Copy link
Member

Another remark: developers should feel impelled to keep their app documentation synced with any related change they commit. Doc files buried far from the source code or even a cumbersome syntax (with lack of editor support, as noted before) may lead to a situation in which devs either simply forget about the existence of related documentation or feel uncomfortable to edit those few lines. A clean workflow, stating what needs to be done before commiting (reflect changes in docs, update release notes, etc.), should follow from these considerations. Outdated documentation is evil. Compare YARP's CONTRIBUTING.md.

@jgvictores
Copy link
Member Author

@jgvictores I think that relpaths could work there, try programs/openraveToStl (or /programs/openraveToStl, or ./programs/openraveToStl).

@PeterBowman Correct, fixed at roboticslab-uc3m/tools@567a8f7

@jgvictores
Copy link
Member Author

I believe we haven't provided options on how to perform this migration. Going to check out: https://www.npmjs.com/package/doxygen2md

@RaulFdzbis
Copy link
Member

I believe we haven't provided options on how to perform this migration. Going to check out: https://www.npmjs.com/package/doxygen2md

Looks good!, at least to deserve a try!

@jgvictores
Copy link
Member Author

jgvictores commented Nov 6, 2017

https://www.npmjs.com/package/doxygen2md

Bad thing is it's not direct like Pandoc. Steps are using Doxygen to create an XML, then apply it. Alternatives I've seen are similar. Let's keep looking.

@jgvictores
Copy link
Member Author

@jgvictores
Copy link
Member Author

To sum up: we prefer .md for most situations, except existing .dox which just set up entry point and groups.

  • Tracking: Migrate doxygen documentation that is almost hidden within the code to README.md per-folder.
  • Do once: Set Doxygen up to generated documentation to link to GitHub URL of new README.md files.

@PeterBowman
Copy link
Member

Do once: Set Doxygen up to generated documentation to link to GitHub URL of new README.md files.

I've set up a dox target in project-generator and install rules that also take care of proper packaging. That is, you run make dox and make package, then CMake and CPack generate HTML docs and pack them for proper distribution. We can't achieve this if relying on URLs. Proposal: convert Markdown files (which are suitable for GH and online viewing) into an exportable markup and generate convenient install and packaging rules. Might be a long-term task.

@jgvictores
Copy link
Member Author

Oh. Something like pandoc to locally convert from .md to .html could be interesting. 👍

@PeterBowman
Copy link
Member

PeterBowman commented May 17, 2018

Note: Doxygen supports Markdown! (reference)

Markdown support was introduced in doxygen version 1.8.0. It is a plain text formatting syntax written by John Gruber, with the following underlying design goal:

Also: Doxygen allows tranclusion (\include command), while Markdown doesn't.

Edit: only partial support, i.e. links to local raw HTML files or HTMLs served remotely (full URLs). No transclusion.

@jgvictores
Copy link
Member Author

Since \includedoc isn't parsed on time, very tempted to pre-process as in https://stackoverflow.com/questions/7857726/sed-replace-backslash-in-include

@jgvictores
Copy link
Member Author

@jgvictores
Copy link
Member Author

@PeterBowman
Copy link
Member

Idea: pass a path to a script in INPUT_FILTER or FILTER_PATTERNS (Doxyfile options) in order to replace a placeholder text inlined in .h docs with the actual MD file contents. Problem (see bolded text):

The INPUT_FILTER tag can be used to specify a program that doxygen should invoke to filter for each input file. Doxygen will invoke the filter program by executing (via popen()) the command:
<filter> <input-file>
where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the name of an input file. Doxygen will then use the output that the filter program writes to standard output. If FILTER_PATTERNS is specified, this tag will be ignored.
Note that the filter must not add or remove lines; it is applied before the code is scanned, but not when the output code is generated. If lines are added or removed, the anchors will not be placed correctly.
Note that for custom extensions or not directly supported extensions you also need to set EXTENSION_MAPPING for the extension otherwise the files are not properly processed by doxygen.

Reference: http://doxygen.nl/manual/config.html#cfg_input_filter.

@jgvictores
Copy link
Member Author

Yes, I'm also concerned about those bold words.

@jgvictores
Copy link
Member Author

Simple commands such as INPUT_FILTER = "sed s/FROM/TO/" work.

Maybe awk would be better than sed.

Before I forget: http://doxygen.10944.n7.nabble.com/input-filter-woes-td2056.html

@jgvictores
Copy link
Member Author

@jgvictores
Copy link
Member Author

It looks like in general sed and \n are not big friends: https://askubuntu.com/questions/603096/replace-string-with-multiline-file-content

@jgvictores
Copy link
Member Author

Just found a tool similar to Doxygen (can't tell the difference): https://github.com/copperspice/doxypress

@jgvictores
Copy link
Member Author

@PeterBowman
Copy link
Member

There is a nice intermix of Markdown and Doxygen capabilities in libraries/YarpCloudUtils/README.md@vision. Even though the document has been written in Markdown, Doxygen is perfectly capable of coping well with it: doxy page. Note that documented classes and functions are automatically linked by Doxygen in text and code snippets. It is also trivial to link back to this page from usual doxy lines, see note.

@PeterBowman
Copy link
Member

YARP is moving towards a deeper integration between Markdown and Doxygen. This patchset esentially migrates a .dox into an .md and adds several Doxygen-like commands (\snippet, \subpage, \ref) throughout those .md files to perform transclusion at the Doxygen level. The documentation is not fully functional on the Markdown side, yet it seems to combine the best of the two worlds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants