zspecza / common-tags

🔖 Useful template literal tags for dealing with strings in ES2015+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Interpolated / nested literals

renatodeleao opened this issue · comments

Hey 👋
First thanks for this very useful package! Found it thanks to this article and is suuuper handy!

Description

I came across a situation where I need to interpolate a "partial" snippet (literal) within another for a documentation example.
I was expecting that a single call html|source|codeBlock would keep indentation correct but apparently, it doesn't. I wonder if this is expected due to some template literal quirk or an actual issue — If expected feel free to close, but a doc reference might be useful since this seems a fairly common scenario (if there's already one and I miss it, I'm sry in advance 😅 )

Demo

Extra context

  • Might be related to #160
  • As you can see in the demo, calling html on each block (snippet) does the trick, but wondering if there's a way to achieve in a single call
  • The reason I'm asking for it is that I'm using this under the hood on a component, <AppSnippet :snippet="codeStr" />, and would like to support template literals whitespace handling under the hood using this package.

Cheers! ✌️