remark-svelte-auto-import

Sun, 26 Nov 2023 13:50:00 +0100

What is this?

This plugin is part of the remark plugin infrastructure and meant to be used in conjunction with mdsvex . mdsvex allows to use Markdown to write your pages within the Svelte framework. Obviously it’s nice to use components within these Markdown files which is support but requires to add the corresponding import into the Markdown file. For instance:


    import { Chart } from '@chartfactory';

# Title

Here is my Chart:

<Chart />

Though feasible the script tag is somewhat annoying here as it’s only reason for existence is to satisfy technical requirements. This is where this plugin remark-svelte-auto-import comests into action. It integrates with the remark infrastructure and generates these imports. Using it would change the above section to this one: