Skip to content

Interpolated / nested literals #216

@renatodeleao

Description

@renatodeleao

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 Support nested html #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! ✌️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions