{#snippet children(d: DrawerSnippetProps)} {@const { mode, snippet, toggle } = d} {@const wordCount = countWordsInText(snippet.plainText)} {@const charCount = snippet.plainText.length} {@const readingTimeMin = Math.max(1, Math.round(wordCount / 200))}
{#if d.open} {MODE_LABELS[mode]} {/if}
{#if d.open}
{#if customChildren} {@render customChildren(d)} {:else if mode === 'default'} {@const outline = snippet.document.children .map((block, blockIndex) => ({ block, blockIndex })) .filter(({ block }) => block.type === 'heading') .map(({ block, blockIndex }) => ({ blockIndex, level: block.type === 'heading' ? block.level : 1, text: block.type === 'heading' ? block.children .map((i) => (i.type === 'text' ? i.text : '')) .join('') : '' })) .filter((e) => e.text.trim())} {@const warnings = collectWarnings(snippet)}

Outline

{#if outline.length === 0}

No headings yet

{:else}
    {#each outline as entry (entry.blockIndex)}
  1. H{entry.level} {entry.text}
  2. {/each}
{/if}

Stats

Words
{wordCount}
Chars
{charCount}
Reading
{readingTimeMin} min

Suggestions {#if warnings.length > 0} {warnings.length} {/if}

{#if warnings.length === 0}

Nothing flagged

{:else}
    {#each warnings as w (w.id)}
  • {w.message}
  • {/each}
{/if}
{:else if mode === 'format'}

Marks

{#each [ { id: 'bold', label: 'B', title: 'Bold' }, { id: 'italic', label: 'I', title: 'Italic' }, { id: 'underline', label: 'U', title: 'Underline' }, { id: 'strike', label: 'S', title: 'Strikethrough' }, { id: 'code', label: '<>', title: 'Inline code' } ] as mark (mark.id)} {/each}

Align

{#each [ { id: 'align-left', label: '⫷', title: 'Left' }, { id: 'align-center', label: '☰', title: 'Center' }, { id: 'align-right', label: '⫸', title: 'Right' }, { id: 'align-justify', label: '☷', title: 'Justify' } ] as a (a.id)} {/each}

Link

{#if snippet.canUnlink} {/if}
{:else if mode === 'image'} {@const block = imageBlockAtCaret(snippet)} {#if block}

Source

{block.src}

Alt text

{block.alt || '(missing)'}

{#if block.caption}

Caption

{block.caption}

{/if} {#if block.status}

Status

{block.status === 'pending' ? 'Uploading…' : 'Upload failed'}

{/if} {:else}

Place caret on an image to edit it.

{/if} {:else if mode === 'table'}

Rows

Columns

Headers

Appearance

Cell tone

{#each [ { id: 'table-cell-tone-default', label: 'Plain' }, { id: 'table-cell-tone-muted', label: 'Muted' }, { id: 'table-cell-tone-accent', label: 'Accent' } ] as t (t.id)} {/each}
{:else if mode === 'code'}

Language

{#each CODE_LANGUAGES as lang (lang.id)} {/each}
{:else if mode === 'list'}

List kind

Indent

{/if}
{/if} {/snippet}