diff --git a/code_data_science/yaml_recipe.py b/code_data_science/yaml_recipe.py new file mode 100644 index 0000000..6c3dbf0 --- /dev/null +++ b/code_data_science/yaml_recipe.py @@ -0,0 +1,15 @@ +from IPython.display import display as ipython_display +import base64 + + +def display(yaml_recipe:str): + """ + Converts YAML recipe as a string to a format that can be visualized as a code snippet. + """ + + # Create the output dictionary + ipython_display({ + "application/vnd.moderne.yamlrecipe": { + "code": base64.b64encode(yaml_recipe) + } + }, raw=True)