diff options
Diffstat (limited to 'examples/with-markdown-plugins')
-rw-r--r-- | examples/with-markdown-plugins/.codesandbox/Dockerfile | 1 | ||||
-rw-r--r-- | examples/with-markdown-plugins/.gitignore | 24 | ||||
-rw-r--r-- | examples/with-markdown-plugins/README.md | 11 | ||||
-rw-r--r-- | examples/with-markdown-plugins/add-classes.mjs | 18 | ||||
-rw-r--r-- | examples/with-markdown-plugins/astro.config.mjs | 16 | ||||
-rw-r--r-- | examples/with-markdown-plugins/package.json | 22 | ||||
-rw-r--r-- | examples/with-markdown-plugins/public/favicon.svg | 9 | ||||
-rw-r--r-- | examples/with-markdown-plugins/src/env.d.ts | 1 | ||||
-rw-r--r-- | examples/with-markdown-plugins/src/layouts/main.astro | 34 | ||||
-rw-r--r-- | examples/with-markdown-plugins/src/pages/index.md | 34 | ||||
-rw-r--r-- | examples/with-markdown-plugins/src/styles/global.css | 53 | ||||
-rw-r--r-- | examples/with-markdown-plugins/tsconfig.json | 3 |
12 files changed, 0 insertions, 226 deletions
diff --git a/examples/with-markdown-plugins/.codesandbox/Dockerfile b/examples/with-markdown-plugins/.codesandbox/Dockerfile deleted file mode 100644 index c3b5c81a1..000000000 --- a/examples/with-markdown-plugins/.codesandbox/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -FROM node:18-bullseye diff --git a/examples/with-markdown-plugins/.gitignore b/examples/with-markdown-plugins/.gitignore deleted file mode 100644 index 16d54bb13..000000000 --- a/examples/with-markdown-plugins/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# build output -dist/ -# generated types -.astro/ - -# dependencies -node_modules/ - -# logs -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* - - -# environment variables -.env -.env.production - -# macOS-specific files -.DS_Store - -# jetbrains setting folder -.idea/ diff --git a/examples/with-markdown-plugins/README.md b/examples/with-markdown-plugins/README.md deleted file mode 100644 index 91811541a..000000000 --- a/examples/with-markdown-plugins/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Astro Example: Markdown with Plugins - -```sh -npm create astro@latest -- --template with-markdown-plugins -``` - -[](https://stackblitz.com/github/withastro/astro/tree/latest/examples/with-markdown-plugins) -[](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/with-markdown-plugins) -[](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/with-markdown-plugins/devcontainer.json) - -This example showcases Astro's [built-in Markdown support](https://docs.astro.build/en/guides/markdown-content/) with additional, user-provided plugins. diff --git a/examples/with-markdown-plugins/add-classes.mjs b/examples/with-markdown-plugins/add-classes.mjs deleted file mode 100644 index 39acabd52..000000000 --- a/examples/with-markdown-plugins/add-classes.mjs +++ /dev/null @@ -1,18 +0,0 @@ -import { selectAll } from 'hast-util-select'; - -export default (additions) => { - const adders = Object.entries(additions).map(adder); - return (node) => adders.forEach((a) => a(node)); -}; - -const adder = ([selector, className]) => { - const writer = write(className); - return (node) => selectAll(selector, node).forEach(writer); -}; - -const write = - (className) => - ({ properties }) => { - if (!properties.className) properties.className = className; - else properties.className += ` ${className}`; - }; diff --git a/examples/with-markdown-plugins/astro.config.mjs b/examples/with-markdown-plugins/astro.config.mjs deleted file mode 100644 index af2d96e75..000000000 --- a/examples/with-markdown-plugins/astro.config.mjs +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'astro/config'; -import addClasses from './add-classes.mjs'; - -// https://astro.build/config -export default defineConfig({ - // Enable Custom Markdown options, plugins, etc. - markdown: { - remarkPlugins: ['remark-code-titles'], - rehypePlugins: [ - 'rehype-slug', - ['rehype-autolink-headings', { behavior: 'prepend' }], - ['rehype-toc', { headings: ['h2', 'h3'] }], - [addClasses, { 'h1,h2,h3': 'title' }], - ], - }, -}); diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json deleted file mode 100644 index 8870481b3..000000000 --- a/examples/with-markdown-plugins/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "@example/with-markdown-plugins", - "type": "module", - "version": "0.0.2", - "private": true, - "scripts": { - "dev": "astro dev", - "start": "astro dev", - "build": "astro build", - "preview": "astro preview", - "astro": "astro" - }, - "dependencies": { - "@astrojs/markdown-remark": "^5.3.0", - "astro": "^4.16.0", - "hast-util-select": "^6.0.2", - "rehype-autolink-headings": "^7.1.0", - "rehype-slug": "^6.0.0", - "rehype-toc": "^3.0.2", - "remark-code-titles": "^0.1.2" - } -} diff --git a/examples/with-markdown-plugins/public/favicon.svg b/examples/with-markdown-plugins/public/favicon.svg deleted file mode 100644 index f157bd1c5..000000000 --- a/examples/with-markdown-plugins/public/favicon.svg +++ /dev/null @@ -1,9 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128"> - <path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" /> - <style> - path { fill: #000; } - @media (prefers-color-scheme: dark) { - path { fill: #FFF; } - } - </style> -</svg> diff --git a/examples/with-markdown-plugins/src/env.d.ts b/examples/with-markdown-plugins/src/env.d.ts deleted file mode 100644 index e16c13c69..000000000 --- a/examples/with-markdown-plugins/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// <reference path="../.astro/types.d.ts" /> diff --git a/examples/with-markdown-plugins/src/layouts/main.astro b/examples/with-markdown-plugins/src/layouts/main.astro deleted file mode 100644 index 80e81fb42..000000000 --- a/examples/with-markdown-plugins/src/layouts/main.astro +++ /dev/null @@ -1,34 +0,0 @@ ---- -import '../styles/global.css'; - -const { content } = Astro.props; ---- - -<html lang={content.lang || 'en'}> - <head> - <meta charset="utf-8" /> - <meta name="viewport" content="width=device-width" /> - <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> - <title>{content.title}</title> - <style> - .nav { - border-bottom: 1px solid #ccc; - margin-bottom: 40px; - padding-bottom: 20px; - } - .nav > * + * { - margin-left: 10px; - } - </style> - </head> - <body> - <main class="content"> - <header> - <nav class="nav"> - <a href="/">Home</a> - </nav> - </header> - <slot /> - </main> - </body> -</html> diff --git a/examples/with-markdown-plugins/src/pages/index.md b/examples/with-markdown-plugins/src/pages/index.md deleted file mode 100644 index 75e184153..000000000 --- a/examples/with-markdown-plugins/src/pages/index.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -layout: ../layouts/main.astro -title: Astro with Remark Plugins ---- - -# Heading 1 - -Sint ullamco sint ut irure laborum occaecat anim minim tempor enim dolore reprehenderit Lorem. Sit qui nisi in quis ut consequat minim. Ad commodo officia nisi culpa proident duis culpa eu reprehenderit incididunt do fugiat proident tempor. Et velit dolor aliqua dolor ipsum. Sunt eiusmod amet enim ut. - -## Heading 2 - -Sint ullamco sint ut irure laborum occaecat anim minim tempor enim dolore reprehenderit Lorem. Sit qui nisi in quis ut consequat minim. Ad commodo officia nisi culpa proident duis culpa eu reprehenderit incididunt do fugiat proident tempor. Et velit dolor aliqua dolor ipsum. Sunt eiusmod amet enim ut. - -### Heading 3 - -Sint ullamco sint ut irure laborum occaecat anim minim tempor enim dolore reprehenderit Lorem. Sit qui nisi in quis ut consequat minim. Ad commodo officia nisi culpa proident duis culpa eu reprehenderit incididunt do fugiat proident tempor. Et velit dolor aliqua dolor ipsum. Sunt eiusmod amet enim ut. - -### Heading 3 - -Sint ullamco sint ut irure laborum occaecat anim minim tempor enim dolore reprehenderit Lorem. Sit qui nisi in quis ut consequat minim. Ad commodo officia nisi culpa proident duis culpa eu reprehenderit incididunt do fugiat proident tempor. Et velit dolor aliqua dolor ipsum. Sunt eiusmod amet enim ut. - -```jsx:file.jsx -import Router from 'next/router' - -function MyComponent() { - const [show, setShow] = useState(false) - - useEffect(() => { - console.log(2) - }, []) - - return <>...</> -} -``` diff --git a/examples/with-markdown-plugins/src/styles/global.css b/examples/with-markdown-plugins/src/styles/global.css deleted file mode 100644 index ced30f0a2..000000000 --- a/examples/with-markdown-plugins/src/styles/global.css +++ /dev/null @@ -1,53 +0,0 @@ -body { - font-family: system-ui; -} - -.content { - max-width: 640px; - margin: 40px auto; - padding: 0 20px; -} - -.title { - position: relative; -} -.title a { - position: absolute; - display: block; - height: 100%; - width: 100%; - color: inherit; -} - -.title a:before { - position: absolute; - right: 100%; - display: block; - content: '#'; - margin-right: 0.2em; - visibility: hidden; - opacity: 0.5; -} - -.title:hover a:before { - visibility: visible; -} - -.remark-code-title, -pre[class^='language-'] { - padding: 10px; - margin: 0; -} - -.remark-code-title { - border-bottom: 1px solid rgba(0, 0, 0, 0.05); - border-radius: 4px 4px 0 0; - background: rgba(0, 0, 0, 0.08); - font-family: monospace; - font-weight: bold; -} - -pre[class^='language-'] { - background: rgba(0, 0, 0, 0.05); - border-radius: 0 0 4px 4px; -} diff --git a/examples/with-markdown-plugins/tsconfig.json b/examples/with-markdown-plugins/tsconfig.json deleted file mode 100644 index d78f81ec4..000000000 --- a/examples/with-markdown-plugins/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "astro/tsconfigs/base" -} |