15. Work in Progress#
Examples of markdown markup that hasn’t yet been mapped over to corresponding OU-XML tags…
15.1. Glossary Items#
We can define a glossary term as:
```{glossary}
Glossary term one
Glossary term one definition is indented
```
- Glossary term one#
Glossary term one definition is indented
We can then refer to a {term}`Glossary term one` TO DO
that links to the glossary listing.
15.2. YouTube Video items (sphinx-contrib.youtube)#
We can embed video items as:
```{youtube} PmxZywVwhP8
```
15.3. Code Execution#
We should be able to execute code purely within the browser using thebe
.
We should also be able to execute code as part of a Sphinx publishing process. Currently, rich media code outputs will be rendered in the HTML output, but only simple text_plain
outputs are rendered into the Sphinx XML and then literally into OU-XML.
Show code cell source
import numpy as np
import pandas as pd
np.random.seed(24)
df = pd.DataFrame({'A': np.linspace(1, 10, 10)})
df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))],
axis=1)
df.iloc[3, 3] = np.nan
df.iloc[0, 2] = np.nan
def color_negative_red(val):
"""
Takes a scalar and returns a string with
the css property `'color: red'` for negative
strings, black otherwise.
"""
color = 'red' if val < 0 else 'black'
return 'color: %s' % color
def highlight_max(s):
'''
highlight the maximum in a Series yellow.
'''
is_max = s == s.max()
return ['background-color: yellow' if v else '' for v in is_max]
df.style.\
applymap(color_negative_red).\
apply(highlight_max).\
set_table_attributes('style="font-size: 10px"')
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import numpy as np
2 import pandas as pd
4 np.random.seed(24)
ModuleNotFoundError: No module named 'numpy'