OpenMS / pyopenms-docs

pyOpenMS readthedocs documentation, additional utilities, addons, scripts, and examples.
https://pyopenms.readthedocs.io
Other
46 stars 55 forks source link

Formulate learning goals at top of each topic. #83

Open timosachsenberg opened 3 years ago

timosachsenberg commented 3 years ago

Maybe in a colored box e.g. something like

In this section, you will learn:

enetz commented 3 years ago

I tried to see what options there are, and it seems making random colored boxes with rst is not trivial. To keep it simple, we can use the "Note" boxes or just an indented list. We don't use those note boxes very often yet. Here is an example how these two options would look like:

pyOpenMS_dec_goals

timosachsenberg commented 3 years ago

I think the note boxes don’t look bad

jpfeuffer commented 3 years ago

Can you try admonition? https://labs.bilimedtech.com/workshops/rst/writing-rst-3.html

We also have to check if it is correctly converted to ipynb.

enetz commented 3 years ago

@jpfeuffer thanks for that link! I tried to find a way to define custom admonitions, but couldn't find an example before, so I tried the Note default.

enetz commented 3 years ago

also about jupyter compatibility, I didn't expect this, using binder:

It turns into simple plain text with Note above (example from a page where a Note was already used before), although jupyter supports the same admonitions, just with a slightly different syntax. It looks like it should be trivial to translate: https://jupyterbook.org/content/content-blocks.html

jupyter_note

jpfeuffer commented 3 years ago

Yes.. unfortunately not supported by pandoc: https://github.com/jgm/pandoc/issues/2610

We would need a custom filter.

timosachsenberg commented 3 years ago

if it is only about the learning goals I think we could also go with the special ignore tag for binder?

jpfeuffer commented 3 years ago

I quickly hacked another pandoc filter:

#!/usr/bin/env python

"""
Pandoc filter to convert divs with class="admonition" to ipynb
"""

import sys
from pandocfilters import toJSONFilter, RawBlock, Div, stringify

def html(x):
    return RawBlock('html', x)

def admonitions(key, value, format, meta):
    if key == 'Div':
        [[ident, classes, kvs], contents] = value
        if "admonition" in classes and format == "ipynb":
            newcontents = [html('<div style="background-color: #BDE5F8; margin: 10px 0px; padding:12px;"><p><i class="fa fa-info-circle"></i> <b>' + stringify(contents[0]) + '</b></p>')] + contents[1:] + [html('</div>')]
            return Div([ident, classes, kvs], newcontents)
        elif "note" in classes and format == "ipynb":
            newcontents = [html('<div style="background-color: #BDE5F8; margin: 10px 0px; padding:12px;"><p><i class="fa fa-info-circle"></i> <b>Note:</b></p>')] + contents + [html('</div>')]
            return Div([ident, classes, kvs], newcontents)

if __name__ == "__main__":
    toJSONFilter(admonitions)
jpfeuffer commented 3 years ago

But not sure how well that works with nestedness.

jpfeuffer commented 3 years ago

By the way, I could not make the admonitions work without HTML in binder. I don't think it supports the full jupyterBOOK format.

jpfeuffer commented 3 years ago

filter was included in #212

tapaswenipathak commented 2 years ago

What are the remaining documentation todos?

jpfeuffer commented 2 years ago

Add learning goals to top of every "applied"/tutorial section of the pyopenms and maybe also the new openms docs.

timosachsenberg commented 9 months ago

any update here from last sprint?

KyowonJeong commented 9 months ago

Yes. I studied how to put this box and tried a few things. I will try to put this box in each algorithm section by the next week.