import { Meta, Canvas } from '@storybook/blocks'; import * as BodyTextStories from './BodyText.stories.svelte'; # BodyText The `BodyText` component creates the main text of your page. You can pass the `text` prop a [markdown-formatted](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) string, which will be parsed into paragraphs, headers, lists, links, blockquotes and other markdown-supported elements. ```svelte ``` ## Using with ArchieML docs With the graphics kit, you'll likely get your text value from an ArchieML doc. ```yaml # Archie ML doc [blocks] type: text text: Bacon ipsum ... ... etc. :end [] ``` ... which you'll parse out of a ArchieML block object before passing to the `BodyText` component. ```svelte {#each content.blocks as block} {#if block.type === 'text'} {/if} {/each} ``` ## Styling text Styles are built in for many text elements created by `BodyText`, including headings, ordered and unordered lists, links, blockquotes and even drop caps (using a `"drop-cap"` classed span). ```svelte ``` ### Custom styles To add your own styling, you can write styles in a global SCSS stylesheet: ```svelte ``` ```scss // global.scss span.highlight { background: palegoldenrod; padding: 2px 4px; } ``` If you want to make sure styles for one portion of text don't apply other parts of the page, add a `class` to BodyText to use as an additional selector. ```svelte highlight=2 ``` ```scss // global.scss .my-special-text-block { span.highlight { background: palegoldenrod; padding: 2px 4px; } } ```