Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape square brackets in the content of an HTML using slim syntax?

I need to print following using slim syntax:

tr 
  td "[Send] Value"

or

tr 
  td [Send] Value

So square brackets are not visible (so interpreted somehow different): I get only Value

How to escape --> [Send] <-- ?

Update:

Some workaround:

tr
  th = "[Send] Value"

but it I hope there is a more "clean" way to escape square brackets, other than using ruby interpreter to escape them

like image 305
static Avatar asked Dec 03 '25 21:12

static


1 Answers

The brackets are being parsed as containing the attributes for the element. You could add a “dummy” set of attribute wrapping brackets:

td () [Send] Value

You could also nest the content on the next line, using the pipe character to signify it’s plain text:

td
  | [Send] Value

Both of these produce <td>[Send] Value</td> as output.

like image 108
matt Avatar answered Dec 05 '25 10:12

matt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!