Mini tip: Outlined (code) blocks with regular font

I think I’ve seen this trick in @Scott_Collier-Weir’s docs — making nice outlined blocks for drawing extra attention. To draw such block, one would use Code Block paragraph style. The problem with it is that it forces all the text in the block to have monospace font (see left).

image

The solution: use formulas and put all the text there. The style of text in formulas will override the “outer” style forced by the block (see right).

Bonus tip: warning boxes with side-by-side icon and text can be created with a Card hidden formula also wrapped in a Code Block paragraph:

Card(
  Image("https://cdn.coda.io/icons/svg/color/delete-sign.svg"),
  Concatenate(
    _Bold("Title"),
    LineBreak(),
    "Message"
  )
).Concatenate("")
7 Likes

Hi! The block with regular font is full screen, unless multiple blocks are placed in columns, side by side. Is this correct?

The block takes the full width of the page or a column, yes.

Thanks for the shoutout!

You can also easily grab icons and input them anywhere in your doc like this:

(1) Right click on an icon in the page title

(2) Select "Copy Image Address"

(3) Paste the copied URL into an Image() formula

5 Likes

One downside worth noting: this is not “free tier” friendly at all because of all those formulas.

It’s possible to reduce the number of formulas used for this by combining multiple formulas together and make it easier to edit with the help of template tables:

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.