Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for YAML block scalars #245

Closed
peterfigure opened this issue Feb 26, 2022 · 2 comments
Closed

Support for YAML block scalars #245

peterfigure opened this issue Feb 26, 2022 · 2 comments

Comments

@peterfigure
Copy link

peterfigure commented Feb 26, 2022

Describe the problem you'd like to solve

Working on a DSL for github actions, would be really nice if a multiline string or list of strings gets rendered as a block scalar, eg: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

It makes for much easier debugging & readability than \n separated strings

Describe the solution you'd like

https://yaml-multiline.info/ literal block scalars using the | symbol

Describe alternatives you've considered

No response

Additional context

No response

@charleskorn
Copy link
Owner

Hey @peterfigure, thanks for the suggestion. Just to clarify, are you asking that any multi-line string values are automatically emitted as block scalars?

If so, that should be pretty straightforward to add as a PR if you're keen:

  • This is where emitting strings happens - it would need to detect if the string contains a newline character and choose a different style (ScalarStyle.LITERAL looks right)
  • We should probably make this behaviour configurable, so you'd need to add an option to YamlConfiguration

@charleskorn
Copy link
Owner

Resolved by #247.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants