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

docs/v7/syntax-overview #18

Open
utterances-bot opened this issue Jul 27, 2020 · 9 comments
Open

docs/v7/syntax-overview #18

utterances-bot opened this issue Jul 27, 2020 · 9 comments

Comments

@utterances-bot
Copy link

autoEscaping | SquirrellyJS

import Hint from 'react-admonitions'

https://squirrelly.js.org/docs/v7/syntax-overview

Copy link

tafandi commented Jul 27, 2020

Can we pass a literal? For example if I have a filter named "pretty_format", and sometimes I just need to pass a hardcoded value to it (to standardize output), seems like I can't use {{"hello" | pretty_format}}

How to make this work?

Thanks

Copy link

Hi,

Helpers start with ~ and are for logic in the template.

but in the example @ is used.

@nebrelbug
Copy link
Collaborator

@pmjlopez thanks for catching that! @ is the correct prefix -- I'll update the docs now.

@nebrelbug
Copy link
Collaborator

@tafandi I just fixed filters so they'll work with any kind of literal.

Copy link

lourot commented Sep 5, 2023

@nebrelbug is there a way to escape the {{ like here? I'm using Squirrelly to render some Vue SFC files, which is a language that also contains such {{ expressions }} and I want Squirrelly to ignore them, for example:

<template>
  <button
    type="button"
    @click="state.count++"
  >
    Counter {{ state.count }}
  </button>
</template>

Squirrelly will throw a ReferenceError because of unknown state but I want Squirrelly to ignore this line. I tried backslashes like \{{ state.count }} but it didn't work. Thanks!

Copy link

lourot commented Sep 5, 2023

I found a way but maybe there is another more elegant way? {{ "{{" }} state.count }}

@nebrelbug
Copy link
Collaborator

@AurelienLourot in your situation, I would probably pass in config options to Squirrelly to change the template delimiters.

lourot added a commit to lourot/bati that referenced this issue Sep 6, 2023
By using now {{{ and }}} as delimiters, i.e. different
from Vue's <template> expression delimiters {{ and }},
less escaping will be needed.

See also
squirrellyjs/squirrelly-docs#18 (comment)
lourot added a commit to lourot/bati that referenced this issue Sep 6, 2023
By using now {{{ and }}} as delimiters, i.e. different
from Vue's <template> expression delimiters {{ and }},
less escaping will be needed.

See also
squirrellyjs/squirrelly-docs#18 (comment)
Copy link

@nebrelbug Are there any syntax highlighting packages for VS Code or Webstorm?

Copy link

Khauri commented May 17, 2024

I found a way but maybe there is another more elegant way? {{ "{{" }} state.count }}

YMMV, but I was able to do it this way in v9.0

{{ '{{state.count}}' }}

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

7 participants