# Automatic documentation conversion from Doxygen

**URL:** <https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908>\
**Category:** ROOT\
**Tags:** python\
**Created:** [March 10, 2021, 11:46am UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908 "2021-03-10T11:46:56Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Salomon](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/salomon/32/18000_2.png) [@Salomon](https://root-forum.cern.ch/u/Salomon)\
**Post date:** [March 10, 2021, 11:46am UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908/1 "2021-03-10T11:46:56Z")

</div>

* * *

_ROOT Version:_ 6.22/02  
_Platform:_ CentOS 7  
_Compiler:_ GCC 4.8

* * *

Dear ROOT developers,

Thank you for a great feature you implemented recently: Multi-Python PyROOT to  
use Python 3 and 2 with a single installation annonced in  
[ROOT Version 6.22 Release Notes](https://root.cern/doc/v622/release-notes.html#multi-python-pyroot).

I want to ask you some questions about ROOT documentation mechanism with Python  
and Jupyter.

R seems to be able to convert documentation from roxygen (source code) to  
console and even Jupyter. For instance I tested this tutorial:  
[Writing an R package from scratch | Not So Standard Deviations](https://hilaryparker.com/2014/04/29/writing-an-r-package-from-scratch/). After documentation build and package installation the comments from my demo package [myFunction\_6916762.tar.gz](https://root-forum.cern.ch/uploads/short-url/1aAIZ9g5Q8HV2XvTs2idGlzDMwO.gz) (744 Bytes) was correctly printed in the console:

```auto
$ R

R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
[...]
> ?myFunction::add

```

```auto

add package:myFunction R Documentation

Add together two numbers

Description:

    Testing add function documentation in bt_spn #20401.

Usage:

    add(x, y)

Arguments:

[...]

(END)

```

and Jupyter:

 ![add](https://root-forum.cern.ch/uploads/default/original/3X/e/4/e4985a244fc428d82bda7a962addccf5f420573f.png) .

Does a similar mechanism exist in ROOT? A previous topic may indicate that this  
wasn’t the case in May 2019: [Python help function on ROOT class methods](https://root-forum.cern.ch/t/python-help-function-on-root-class-methods/34328).  
However I suppose ROOT may have new documentation features in recent releases.

Is [Chapter: HTMLDoc](https://root.cern.ch/root/htmldoc/guides/users-guide/HTMLDoc.html) an equivalent of R documentation mechanism?

It would be nice to have Doxygen documentation into Cling, Python and  
Jupyter.

Best regards,

---

<div class="post-metadata">

**Author:** ![jblomer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/439d5e/32.png) [@jblomer](https://root-forum.cern.ch/u/jblomer)\
**Post date:** [March 10, 2021, 5:21pm UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908/2 "2021-03-10T17:21:10Z")

</div>

@couet Is this something you can comment on?

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 12, 2021, 8:24am UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908/3 "2021-03-12T08:24:27Z")

</div>

In ROOT we build the [reference guide](https://root.cern/doc/master/index.html) automatically with doxygen. The link you are pointing too (HTMLDoc) is the old User’s Guide we are now replacing by the [online manual](https://root.cern/manual/). The [THtml class is now deprecated](https://root.cern/doc/master/classTHtml.html).

---

<div class="post-metadata">

**Author:** ![Salomon](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/salomon/32/18000_2.png) [@Salomon](https://root-forum.cern.ch/u/Salomon)\
**Post date:** [March 12, 2021, 3:32pm UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908/4 "2021-03-12T15:32:01Z")

</div>

Thank your for your answer.

Sorry I should have looked at [ROOT: THtml Class Reference](https://root.cern/doc/master/classTHtml.html) before mentioning it.

Is it possible to fetch Doxygen comments and print them in Cling, Python and Jupyter (ROOT C++ and Python)?

For instance how to easily access to `TCanvas::GetWindowTopX()` documentation shown in [ROOT: TCanvas Class Reference](https://root.cern/doc/v622/classTCanvas.html#a2aa8e879505f21da08af0853abe640c2)?

> Returns current top x position of window on screen.

I used [ROOT: TClass Class Reference](https://root.cern/doc/v622/classTClass.html#ad38e0a5a43942c286f2916cf752f656f) but wasn’t able to print the comment, e.g.:

```auto
$ root
   ------------------------------------------------------------------
  | Welcome to ROOT 6.22/02 https://root.cern |
  | (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Aug 17 2020, 12:46:52 |
  | From tags/v6-22-02@v6-22-02 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------------

root [0] auto canvas = TClass::GetClass("TCanvas")
(TClass *) @0x7ffd5f1ea8f0
root [1] canvas->GetMethodAllAny("GetWindowTopX")->GetPrototype()
(const char *) "Int_t TCanvas::GetWindowTopX()"

```

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 12, 2021, 3:35pm UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908/5 "2021-03-12T15:35:14Z")

</div>

> [@Salomon](#):
>
> For instance how to easily access to `TCanvas::GetWindowTopX()` documentation shown in [ROOT: TCanvas Class Reference](https://root.cern/doc/v622/classTCanvas.html#a2aa8e879505f21da08af0853abe640c2)?

```auto
root [0] .help TCanvas::GetWindowTopX

```

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [March 12, 2021, 3:42pm UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908/6 "2021-03-12T15:42:26Z")

</div>

I think the underlying question is: does/can `cling` know about doxygen comments for functions and classes, the same way as Python functions and classes store theirs in their ` __doc__ ` attribute? (because all ways to use ROOT interactively – ROOT prompt, jupyter notebooks and Python/PyROOT – ultimately rely on `cling` to call into the C++ code).

I’m pretty sure the answer is that cling, like the good C++ interpreter it is, completely ignores comments 😅 @Axel is that right?

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [March 15, 2021, 5:05pm UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908/7 "2021-03-15T17:05:47Z")

</div>

`cling` _does_ know about comments 🙂 But going from there to documentation means re-implementing doxygen in ROOT. That’s a BIG project… I think `.help` is a more reasonable path: it makes use of doxygen’s power, has a nicer presentation (though some prefer terminals), - and we have it already.

---

<div class="post-metadata">

**Author:** ![Salomon](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/salomon/32/18000_2.png) [@Salomon](https://root-forum.cern.ch/u/Salomon)\
**Post date:** [March 19, 2021, 1:51pm UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908/8 "2021-03-19T13:51:58Z")

</div>

Thank you for your answers. I suppose the method [ROOT: TObject Class Reference](https://root.cern/doc/v622/classTObject.html#a2a79fcd627629cb2b19d54bf6a6935db) may suggest that ROOT can “understand” some comments as @Axel said.

`.help` metacommand is indeed powerful as mentionned in  
[.help metacommand extension and use with Python/Jupyter](https://root-forum.cern.ch/t/help-metacommand-extension-and-use-with-python-jupyter/43902).

Then what about retrieving (local) Doxygen information into console?  
_Warning_: Viewer discretion advised:

```auto
$ root
   ------------------------------------------------------------------
  | Welcome to ROOT 6.22/02 https://root.cern |
  | (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Aug 17 2020, 12:46:52 |
  | From tags/v6-22-02@v6-22-02 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------------

root [0] gSystem->Exec("links file:///data/[...]/URANIE/20401/[...]/root/doxygen/master/classTCanvas.html#a2aa8e879505f21da08af0853abe640c2")

```

```auto
   Int_t TCanvas::GetWindowTopX ( )                                                                                                                                                     
                                                                                                                                                                                         
   Returns current top x position of window on screen.                                                                                                                                   
                                                                                                                                                                                         
   Definition at line 1186 of file TCanvas.cxx.

```

Then `q` to quit:

```auto
                                                                                                                                                                                         
   Reimplemented from TPad. +---------------- Quitter ? -----------------+                                                                      
                                                                     | |                                                                      
   Definition at line 165 of file TCanvas.h. | Êtes-vous sûr de vouloir quitter Links ? |                                                                      
                                                                     | |                                                                      
   Size_t TCanvas::GetXsizeReal ( ) const inline | [Oui] [Non] |                                                                      
                                                                     +--------------------------------------------+                                                                      
   Definition at line 157 of file TCanvas.h.                                                                          

```

```auto
(int) 0
root [1] .q

```

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 22, 2021, 9:13am UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908/9 "2021-03-22T09:13:21Z")

</div>

> [@Salomon](#):
>
> Then what about retrieving (local) Doxygen information into console?

That would imply to have the full Doxygen manual installed locally on machine ? isn’t ?  
And that would fly for simple helps like the example you showed. But try complex classes with huge help, full of plots like THistPainter…

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [March 22, 2021, 2:01pm UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908/10 "2021-03-22T14:01:00Z")

</div>

…and we only have limited resources, so we need to really focus on what’s needed by the vast majority of our users. We did not have a lot of requests for doc in terminal (through we did have some!)

Given the current “polls” I don’t expect this to happen.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [April 5, 2021, 2:01pm UTC](https://root-forum.cern.ch/t/automatic-documentation-conversion-from-doxygen/43908/11 "2021-04-05T14:01:49Z")

</div>

Closed on April 5, 2021, 2:01pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
