Table component for
mdsvexMarkdown tables that responsively switches to list format on small screens.
- Install:
npm install mdsvex-table
- If you don't have an MDsveX layout component configured, add one:
preprocess: [mdsvex({ extensions: ['.svx', '.md'], layout: join(__dirname, './src/routes/MdLayout.svelte') // Or whatever you wish })],
- Re-export all table components in
mdsvex-tablefrom the layout(s) component(s) as per MDsveX's instructions:<script lang="ts" module> // export * ... doesn't work. 😢 export { table, thead, tbody, tr, th, td } from 'mdsvex-table'; </script>
- Still in the layout, create the table context:
<script lang="ts"> import { setTableContext, TableContext } from 'mdsvex-table'; setTableContext(new TableContext({ /* options */ })); </script>
- Style the list version of the tables (see documentation).