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

Escaping code blocks within comment blocks #359

Open
binarycow opened this issue May 19, 2021 · 2 comments
Open

Escaping code blocks within comment blocks #359

binarycow opened this issue May 19, 2021 · 2 comments

Comments

@binarycow
Copy link
Contributor

binarycow commented May 19, 2021

Sometimes, I use a comment inside a code block as a header for the template. Since I don't want the comment itself to be output to the template, so I need Scriban to interpret it - so I put it in the code block.

Example:

{{- ##
   This is a description of my template.
## -}}

Sometimes I want to put an example of a Scriban code block in the comment.

Example:

{{- ##

  If you want to use option A, paste the following line into your template:
     {{ "There are " + numberOfLions + " lions in the zoo." }}

## -}}

I would like the code block inside the comment block to be escaped.

Currently, the Scriban renderer sees the }} inside the comment block to be the end of the comment block and the outer code block.

Additionally, no syntax error is presented for failure to properly close the comment block.

@xoofx
Copy link
Member

xoofx commented May 25, 2021

Currently, the Scriban renderer sees the }} inside the comment block to be the end of the comment block and the outer code block.

Yes, the original behavior was to allow something like {{ ## This is a comment }} when you want to comment the rest of the function.

Any fix will have to preserve this behavior.

@InspiringCode
Copy link

It would be really helpful to have a way to include scriban examples with code blocks in comments. Is there currently ANY way to do this?

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

No branches or pull requests

3 participants