Skip to content

Commit

Permalink
docs(plugin-component): fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
BearToCode committed Jul 6, 2024
1 parent 81fea31 commit 4d26eb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions docs/src/pages/plugins/component.svelte.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ For example, if you want to use a custom renderer for images:

```ts
import { Carta } from 'carta-md';
import { attachment } from '@cartamd/plugin-attachment';
import { svelte, initializeComponents } from '@cartamd/plugin-attachment/svelte';
import { component } from '@cartamd/plugin-component';
import { svelte, initializeComponents } from '@cartamd/plugin-component/svelte';
import Image from './Image.svelte';

const mapped = [svelte('img', Image) /* other components ... */];

const carta = new Carta({
extensions: [attachment(mapped, initializeComponents)]
extensions: [component(mapped, initializeComponents)]
// ...
});
```
Expand All @@ -64,7 +64,7 @@ You can use custom logic when selecting which nodes to map:
<Code>

```ts
import { svelteCustom } from '@cartamd/plugin-attachment/svelte';
import { svelteCustom } from '@cartamd/plugin-component/svelte';
import MyComponent from '...';

const mapped = [
Expand Down Expand Up @@ -107,7 +107,7 @@ When pre-rendering content on the server (using the `<PreRendered>` component),

```svelte
<script>
import { initializeComponents } from '@cartamd/plugin-attachment/svelte';
import { initializeComponents } from '@cartamd/plugin-component/svelte';
import { onMount } from 'svelte';
// ...
Expand Down
10 changes: 5 additions & 5 deletions packages/plugin-component/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ For example, if you want to use a custom renderer for images:

```ts
import { Carta } from 'carta-md';
import { attachment } from '@cartamd/plugin-attachment';
import { svelte, initializeComponents } from '@cartamd/plugin-attachment/svelte';
import { component } from '@cartamd/plugin-component';
import { svelte, initializeComponents } from '@cartamd/plugin-component/svelte';
import Image from './Image.svelte';

const mapped = [svelte('img', Image) /* other components ... */];

const carta = new Carta({
extensions: [attachment(mapped, initializeComponents)]
extensions: [component(mapped, initializeComponents)]
// ...
});
```

You can use custom logic when selecting which nodes to map:

```ts
import { svelteCustom } from '@cartamd/plugin-attachment/svelte';
import { svelteCustom } from '@cartamd/plugin-component/svelte';
import MyComponent from '...';

const mapped = [
Expand Down Expand Up @@ -78,7 +78,7 @@ When pre-rendering content on the server (using the `<PreRendered>` component),

```svelte
<script>
import { initializeComponents } from '@cartamd/plugin-attachment/svelte';
import { initializeComponents } from '@cartamd/plugin-component/svelte';
import { onMount } from 'svelte';
// ...
Expand Down

0 comments on commit 4d26eb8

Please sign in to comment.