Consider supporting YAML same line comments

0 votes
asked Feb 3, 2021 in Wanted features by Martin (8,320 points)
edited Feb 5, 2021 by Martin

Plain scalars in YAML are not allowed to contain the character combination " #", as this indicates a comment to the end of line.  But currently Plantuml will treat the comments as part of the data.

Take for example "Example 2.2.  Mapping Scalars to Scalars" in

hr:  65    # Home runs
avg: 0.278 # Batting average
rbi: 147   # Runs Batted In

The comment text shouldn't really be displayed.  I see a use case of Plantuml YAML where users would cut and paste existing yaml from config files in order to get a picture representation.  Such files are highly likely to contain comment text.

1 Answer

0 votes
answered Feb 5, 2021 by Martin (8,320 points)
edited Feb 5, 2021 by Martin

This is now largely supported, thank you!

Except that only "<space>#" should be recognised as a comment.  The following should actually include all the text - there are no 'comments' in this example:

hr:  65# Home runs
avg: 0.278# Batting average
rbi: 147# Runs Batted In


  "hr": "65# Home runs", 
  "avg": "0.278# Batting average", 
  "rbi": "147# Runs Batted In"