# Markdown support in the library?

**URL:** <https://openturns.discourse.group/t/markdown-support-in-the-library/315>\
**Category:** Development\
**Created:** [August 23, 2023, 4:37pm UTC](https://openturns.discourse.group/t/markdown-support-in-the-library/315 "2023-08-23T16:37:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichaelBaudin](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/michaelbaudin/32/9_2.png) [@MichaelBaudin](https://openturns.discourse.group/u/MichaelBaudin)\
**Post date:** [August 23, 2023, 4:37pm UTC](https://openturns.discourse.group/t/markdown-support-in-the-library/315/1 "2023-08-23T16:37:15Z")

</div>

Hi!  
I am thinking about adding new pretty-print features for new objects based on the Markdown format. Indeed, in the [PR 2282](https://github.com/openturns/openturns/pull/2282) on polynomial chaos expansion, I created two pretty-print features for the PCE:

- an HTML pretty-print, for the Jupyter Notebook rendering and the help pages (see the result [here](http://openturns.github.io/openturns/latest/auto_meta_modeling/polynomial_chaos_metamodel/plot_chaos_ishigami.html#create-the-polynomial-chaos-model)),
- a Markdown pretty-print available with the Python interpreter and which is correctly rendered in Github, Obsidian (and any other Markdown editor).

This prints the Sobol’ indices of a PCE very nicely (see it [here](http://openturns.github.io/openturns/latest/auto_meta_modeling/polynomial_chaos_metamodel/plot_chaos_ishigami.html#compute-and-print-sobol-indices)).

I am thinking about adding this feature for the linear regression models, such as `LinearModelResult` and `LinearModelAnalysis`. Often, a table can be created that better organizes the results, e.g. the ANOVA table of the coefficients. The current implementation is based on ASCII-art, see [here](http://openturns.github.io/openturns/latest/auto_meta_modeling/general_purpose_metamodels/plot_linear_model.html#anova-table):

```auto
Coefficients:
           | Estimate | Std Error | t value | Pr(>|t|) |
--------------------------------------------------------------------
[x,y]->[1] | 2.99847 | 0.0204173 | 146.859 | 9.82341e-41 |
[x,y]->[x] | 2.02079 | 0.0210897 | 95.8186 | 9.76973e-36 |
[x,y]->[y] | -0.994327 | 0.0215911 | -46.0527 | 3.35854e-27 |
--------------------------------------------------------------------

```

Implementing the HTML rendering is straightforward, but the Markdown rendering is trickier, because we have to deal with column alignment. Hence, the coding might be difficult to maintain: what if we add a new attribute that we want to pretty-print?

So I am thinking on the following development process. If the `Sample` class provided a Markdown pretty-print, then we could use it in other classes to pretty-print more easily other tables. In the previous linear regression example, we may create a `Sample` in dimension 5 and trigger the pretty-print of the Sample. This will make impossible to create the first column in the previous table, which contains strings that cannot be stored within a `Sample`. In this case, could we use `Pandas.DataFrame` in the Python layour, just for its pretty-print features? Would this raise a dependency issue in terms of Conda or Pip requirements?

Regards,  
Michaël
