So the first issue, as you’ve commented yourself, is that //
isn’t legal commenting (at least not in Obsidian), so you need to change that into #
. After that you still don’t get the output you want, but I don’t think you see that you’re not getting the definitions you want either.
The image you list with your numbers, are not actually defining any of the POSTGRES_*
variables. It’s kind of legal YAML, but it’s defining a list of unquoted strings, and as such no formatting occurs. The same applies to the string starting with db-data:/var/lib/...
If we show the fields as defined within console, we get this output:

Do you see how the 5438
, POSTGRES_*
and db-data
are all just lists of strings, and not actual field definitions? All of these have one thing in common, and that is that they’re prefixed with -
which jumbles up the defintions. The postgress stuff does in addition use =
, and not :
in an attempt to separate the fields.
If we correct both of those issues we get the following YAML:
```yaml
# docker-compose.yaml
version: '3'
services:
mypostgres: # name
image: 'posgres'
image2: posgres
ports:
5438: 5432
# - 5432: 5432
environment:
POSTGRES_PASSWORD: db_pass
POSTGRES_USER: db_user
POSTGRES_DB: db_name
volumes:
db-data: /var/lib/postgresql/data # check where
volumes:
db-data:
driver: local
```
And within the forum posts, this shows the differentiation between fields and values. Within Obsidian (in default theme reading view) this shows as:
And the corresponding console output is now:

There is still a lack of formatting between the non-quoted text and quoted text, but the formatter also shows a difference in the markup where the the quoted texts are indeed formatted as “strings”, whilst the non-quoted text are just non-quoted and passes straight through.
(I’m not quite sure why my field names are yellow, and not yours)
Also note the difference if you precede the POSTGRES_*
with -
, that then the console output becomes:

It’s an array of objects, with three elements where the first element has the password field, the second element has the user field, and the third element has the db field. This opposed to having the environment fields defined directly as fields under environment
like the previous images showcases.
In summary, you need to use #
for comments, and :
to separate field names and values, and finally using -
in front of your text defines the fields within a list context. For proper field definitions use indentation of two spaces