zspecza / common-tags

🔖 Useful template literal tags for dealing with strings in ES2015+
Other
1.99k stars 60 forks source link

Interpolated / nested literals #216

Open renatodeleao opened 2 years ago

renatodeleao commented 2 years ago

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

Cheers! ✌️