Closed pascalwhoop closed 1 year ago
Hi Pascal,
I need a little more context. Perhaps you could make a small reproducable example?
I'm guessing you're using read_yaml
? That in turn uses yaml.safe_load()
to load to a python dictionary. That is then turned into a pandas dataframe using pd.json_normalize()
, and then converted to markdown.
yaml is a tricky 'language' -- it seems to me that the definition column actually has a list of 3 items instead of a multi-line string. You can check that in python using import yaml; yaml.safe_load('path to your yaml file' )
It's highly unlikely I can do something in this package to change the behaviour
Just came across this page on YAML and multi-line strings and thought of this issue, might be helpful: https://yaml-multiline.info/
TLDR; mkdocs
does not support this!
Ok, I played around with it a bit:
- term: prompt
definition: |
A
B
C
- term: else
definition: cool
with open(args[0], "r") as f:
j = list(yaml.safe_load(f))
df = pd.json_normalize(j
This gives what we expect:
It's this part that is the 'problem':
That part is taken care of by the tabulate
poackage. There we use the tablefmt pipe
because it's compatible with mkdocs. And that format does not support multiline strings.
Which in turns brings me to the mkdocs website (https://www.mkdocs.org/user-guide/writing-your-docs/):
:(
When using multi-line strings it converts it to multiple lines in markdown. Any chance to get this to render as a single cell with multiple lines (as in
<br/>
) instead?