mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
13 lines
389 B
Python
13 lines
389 B
Python
import json
|
|
import textwrap
|
|
import yaml
|
|
|
|
|
|
def metadata_example(cog, example):
|
|
cog.out("\n.. tab:: YAML\n\n")
|
|
cog.out(" .. code-block:: yaml\n\n")
|
|
cog.out(textwrap.indent(yaml.dump(example), " "))
|
|
cog.out("\n\n.. tab:: JSON\n\n")
|
|
cog.out(" .. code-block:: json\n\n")
|
|
cog.out(textwrap.indent(json.dumps(example, indent=2), " "))
|
|
cog.out("\n")
|