Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@elron/svelte-wp-shortcode
Advanced tools
Effortlessly blend Svelte components into content with WordPress-inspired shortcodes. Simplify dynamic embedding with a familiar touch.
Effortlessly blend Svelte components into content with WordPress-inspired shortcodes. Simplify dynamic embedding with a familiar touch.
<slot>
mechanism. It also supports export let slot
if you need the slot content as a variable.# pnpm
pnpm install @elron/svelte-wp-shortcode@latest
# npm
npm install @elron/svelte-wp-shortcode@latest
# Yarn
yarn install @elron/svelte-wp-shortcode@latest
import WpShortcodes from '@elron/svelte-wp-shortcode';
// Import Your Own Custom Svelte Components
import TryButton from './TryButton.svelte';
import Note from './Note.svelte';
import Youtube from './Youtube.svelte';
import Strong from './Strong.svelte';
<WpShortcodes
markup={`
Simple embed: [try-button]
Text within: [note]Here's some inner text![/note]
With properties: [youtube id=EVP1NQAnpYk]
All combined: [strong color="red" class="text-xl"]Awesome, right?[/strong]
With HTML: <i>Still works!<i>
`}
components={{
'try-button': TryButton,
'note': Note,
'youtube': Youtube,
'strong': Strong
}}
/>
Voilà! The <TryButton>
, <Note>
, <Youtube>
, and <Strong>
Svelte components are rendered based on their respective shortcode types. Obviously, you can replace them with your own components.
[example message="hey"]
or no quotes at all [example message=hey]
. Single quotes won't work.slot
is reserved so you can use export let slot
if needed (<slot />
is supported as well). Example: If this is the shortcode [shortcode slot="Initial Content"]Overridden Content[/shortcode]
then export let slot
the slot
value will become Overriden Content
.There is a known svelte issue - {@html} tag is broken during hydration #8213 - that causes the @html code to render badly (duplicates itself).
If you encounter an issue, there are two known workarounds for now.
{#key mounted}
wrapperThis workaround still supports SSR (good for SEO).
<script lang="ts">
import WpShortcodes from '@elron/svelte-wp-shortcode';
import TryButton from './WpShortcodes/TryButton.svelte';
export let markup: string;
let components = { 'try-button': TryButton };
onMount(() => {
mounted = true;
});
</script>
{#key mounted}
<WpShortcodes {components} {markup} />
{/key}
+page.ts
file:This will disable SSR (bad for SEO).
export const csr = false;
If you've found another workaround or a fix, please share in the repo, would love your contribution!
Your input is valued! Share your feedback, report bugs, or make pull requests on our GitHub repository.
This project is licensed under the MIT License - see the LICENSE.md file for details.
FAQs
Effortlessly blend Svelte components into content with WordPress-inspired shortcodes. Simplify dynamic embedding with a familiar touch.
We found that @elron/svelte-wp-shortcode demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.