question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use YAML examples in documentation by default, not JSON

See original GitHub issue

YAML configuration is much better for multi-line strings, and I’m increasingly adding configuration options to Datasette that benefit from that - fragments of HTML in description_html or SQL queries used to configure things like https://github.com/simonw/datasette-atom for example.

Rather than confusing things by showing both in the documentation, I should switch all of the default examples to use YAML instead.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
simonwcommented, Mar 23, 2021

Beginnings of a UI element for switching between them:

<div style="border: 1px solid rgb(225, 228, 229);
  background-color: rgb(238, 255, 204);
  padding: 0.3em;
  position: relative;
  top: 3px;
  font-family: courier;">
<a href="#" style="display: inline-block; padding-left: 0px; padding-right: 2em;">JSON</a>
<a href="#" style="display: inline-block;">YAML</a>
</div>
Metadata_—_Datasette_documentation

That <pre> has a padding of 12px, so using 12px padding on the tab links should get them to line up better.

0reactions
simonwcommented, May 20, 2022

Undocumented Sphinx feature: you can add extra classes to a code example like this:

.. code-block:: json
   :class: metadata-json

    {
        "databases": {
            "russian-ads": {
                "tables": {
                    "display_ads": {
                        "fts_table": "ads_fts",
                        "fts_pk": "id",
                        "searchmode": "raw"
                    }
                }
            }
        }
    }

https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-code-block doesn’t mention this.

Filed an issue about the lack of documentation here:

Read more comments on GitHub >

github_iconTop Results From Across the Web

YAML Tutorial: Everything You Need to Get Started in Minutes
Here's a YAML tutorial to get you started quickly. ... Before we take a deeper dive, let's look at how this document looks...
Read more >
Is there a way to generate API Documentation in YAML (not ...
I would like to generate the API documentation in YAML format, not JSON. By default, springfox generates JSON. I have looked into using...
Read more >
10 YAML tips for people who hate YAML | Enable Sysadmin
This works best for small data sets. Just write your JSON data into a Python variable, prepend an import statement, and end the...
Read more >
YAML Tutorial | User Manual - Taurus
YAML format allows multiple documents to be embedded in a single file. They only have to be separated with a line containing triple-dash...
Read more >
YAML Syntax - Ansible Documentation
We use YAML because it is easier for humans to read and write than other common data formats like XML or JSON. Further,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found