Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove invalid indentations and empty line break, so that the partial can be used in nested shortcode #33

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

razonyang
Copy link
Member

Alternative to #32.

@razonyang razonyang mentioned this pull request Jan 8, 2024
@TetraTheta
Copy link
Contributor

In my local test, this PR also fixes the problem issued in #32. Since my approach was brutal way of fixing the problem, I don't have any objection about this PR.


you'll noticed that the inner shortcode changes won't be hot-reload, you've to restart server and see the changes.

In fact, I have to stop the preview server, delete resources directory, then restart the server to get properly rendered result. If I don't, I often get multiple 'collapses' get expanded/collapsed in single click, which means something got wrong...

Not sure why, but this might be the reason of child header menu doesn't appear when parent header menu is clicked in production website. Re-building the site fixed the issue though.

Besides, I don't like to use nested shortcodes recently

But sometimes, I really want to use shortcode inside of another shortcode. In most cases, I use gallery/image at top-level, but sometimes, I have to 'hide' them inside of <details> or 'collapse' because they are not that important and just eating up article space.

In that case, I have to use nested shortcode, or use <details> HTML tag and put those things inside of it. But <details> tag isn't look nice without custom CSS which I can't do it well.

I don't know how other 'template engine' handles this 'nested shortcode'...

Alternatively, to avoid similar issues, you can pass the markdown content to gallery/image, and use RenderString (or sthelse) to render it.

I think that hurts the purpose of using shortcodes. Markdown texts can be passed to gallery/image and be processed in there, but the purpose of gallery/image is showing multiple images and optional caption. Passing text that might not be related to the image doesn't look good to me.

Yeah, this would be personal taste. I just prefer combining markdown text and shortcodes within another shortcode, rather than passing markdown text to inner shortcode, even though it causes problem sometimes...


Anyway, this PR looks good to me! Thank you a lot!

@razonyang razonyang merged commit 30f968b into main Jan 8, 2024
1 check passed
@razonyang
Copy link
Member Author

You're welcome, I drafted a new release, I also added you as a collaborator on 30f968b commit, thanks for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants