Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

shortcodes with HTML in {{< tab >}} are stripped #131

Open
mattmoor opened this issue Feb 7, 2020 · 5 comments
Open

shortcodes with HTML in {{< tab >}} are stripped #131

mattmoor opened this issue Feb 7, 2020 · 5 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@mattmoor
Copy link
Member

mattmoor commented Feb 7, 2020

So I hit this trying to use #126 from within a tab...

Basically, unless I flip the switch to allow HTML through from markdown (even though the HTML is coming from a shortcode!) the HTML generated by my feature-state is scrubbed 😢

I suspect that this is a problem with tab, not the new stuff, but I don't speak this stuff well enough to meaningfully debug (it's all trial and error).

cc @RichieEscarez in case he has any quick insights 🙏

@mattmoor mattmoor added the kind/bug Categorizes issue or PR as related to a bug. label Feb 7, 2020
@RichieEscarez
Copy link
Contributor

@mattmoor, each shortcode gets sent to the markdown processor by default but there are ways to indicate not to process (ie. just copy content). Hugo gets unhappy we you nest shortcodes (one calls the other, etc.).

Sorry i dont have time to dig in but i describe some of this here in the readfile shortcode.

In short {{%... goes to processor, {{<.... skips it. There is also {{-... that removes whitespace (example in version shortcode). Another helpful method is Scratch (examples in both shortcodes), which allows you to use a single variable which you can then set a specific value (ie. if this, then that).

@mattmoor
Copy link
Member Author

mattmoor commented Feb 8, 2020

@RichieEscarez that's super helpful, I will dig into that some more :)

@mattmoor
Copy link
Member Author

mattmoor commented Feb 8, 2020

I think that this is essentially what the tabs are hitting:

IMPORTANT: You cannot nest shortcodes. When the Hugo build runs on a file,
any shortcodes within that file are processed. For example, if you use `readFile`
to include a source file, and that source file contains another shortcode,
none of those "nested shortcodes" are processed. Nesting a shortcode within another
shortcode results in incorrectly rendered content
(ie. `{{% the short code syntax shows in the HTML of the parent file %}}`).

@RichieEscarez
Copy link
Contributor

@RichieEscarez
Copy link
Contributor

Looks like there might be a path to fixing this but some investigation and testing needs to be done: #227

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants