Ihor Radchenko <yanta...@gmail.com> writes:

> 1. org-protecting-blocks is an internal auxiliary variable used to
>    determine which blocks should be fontified using different major
>    mode.
>    It's value is ("src" "example" "export")
>    So, #+begin_src lang and #+begin_export lang are fontified according
>    to LANG. Makes sense.
>    However, what about #+begin_example?
>    org-element-example-block-parser does not appear to expect language
>    specification in the example blocks. Only switches seems to be
>    allowed. Am I missing something and Org actually allows example
>    blocks to specify language? Or was it the case in the distant past
>    versions of Org?
>

Speaking as a user, I've used fontified example blocks for json
responses when using ob-http:

#+begin_src http :pretty :wrap example json
GET http://es-master.service.consul:9200/_cluster/settings?pretty
#+end_src

#+RESULTS:
#+begin_example json
{
  "persistent": {
    "cluster": {
      "routing": {
        "allocation": {
          "node_concurrent_incoming_recoveries": "20",
          "enable": "all",
          "node_concurrent_outgoing_recoveries": "20"
        }
      }
    },
    "xpack": {
      "monitoring": {
        "collection": {
          "enabled": "true"
        }
      }
    }
  },
  "transient": {}
}
#+end_example

In this case, ob-http seems to default to generating example blocks. I
realized I could add a bit there to get it to fontify as JSON.

I'm unsure if this is correct usage or merely a side effect, or if
there's a better block to be using for this purpose, but I figured I
could at least contribute a user report about this feature.

I'm on org-mode 9.5.3 if that matters.

-- Ted Reed

Reply via email to