summaryrefslogtreecommitdiff
path: root/examples/remote-markdown/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/remote-markdown/src')
-rw-r--r--examples/remote-markdown/src/components/Yell.jsx5
-rw-r--r--examples/remote-markdown/src/layouts/main.astro14
-rw-r--r--examples/remote-markdown/src/pages/index.astro72
3 files changed, 91 insertions, 0 deletions
diff --git a/examples/remote-markdown/src/components/Yell.jsx b/examples/remote-markdown/src/components/Yell.jsx
new file mode 100644
index 000000000..ae7d0d959
--- /dev/null
+++ b/examples/remote-markdown/src/components/Yell.jsx
@@ -0,0 +1,5 @@
+import { h, Fragment } from 'preact';
+
+export default function Yell({ children }) {
+ return children.filter(v => typeof v === 'string').join('').toUpperCase() + '!'
+}
diff --git a/examples/remote-markdown/src/layouts/main.astro b/examples/remote-markdown/src/layouts/main.astro
new file mode 100644
index 000000000..37fcc0ee7
--- /dev/null
+++ b/examples/remote-markdown/src/layouts/main.astro
@@ -0,0 +1,14 @@
+---
+export let content;
+---
+
+<html>
+ <head>
+ <title>{content.title}</title>
+ </head>
+
+ <body>
+ <slot />
+ <pre>{JSON.stringify(content)}</pre>
+ </body>
+</html>
diff --git a/examples/remote-markdown/src/pages/index.astro b/examples/remote-markdown/src/pages/index.astro
new file mode 100644
index 000000000..402780065
--- /dev/null
+++ b/examples/remote-markdown/src/pages/index.astro
@@ -0,0 +1,72 @@
+---
+import Markdown from 'astro/components/Markdown.astro';
+import Yell from '../components/Yell.jsx';
+const title = 'INTERPOLATED';
+const quietTest = 'interpolated';
+const content = await fetch('https://raw.githubusercontent.com/snowpackjs/snowpack/main/README.md').then(res => res.text());
+---
+
+<!-- Basic -->
+<Markdown>
+# Hello world!
+</Markdown>
+
+ <!-- Indented -->
+ <Markdown>
+ # Hello indent!
+ </Markdown>
+
+<!-- Interpolation -->
+<Markdown>
+# Hello {title}!
+</Markdown>
+
+
+ <!-- Can I break this? -->
+ <Markdown>
+ # I cannot!
+
+ <div>
+ # ahhhh
+ </div>
+
+ <Yell>{quietTest}</Yell>
+
+ <strong>Dope</strong>
+
+ `nice`
+
+ ```
+ plain fence
+ ```
+
+ ```html
+ don't <div>me</div> bro
+ ```
+
+ ```js
+ Astro.fetchContent()
+ ```
+
+ ### cool stuff?
+ ```astro
+ {'can\'t interpolate'}
+ {}
+ {title}
+
+ Do I break? <Markdown> </Markdown>
+ ```
+ </Markdown>
+
+<!-- external content -->
+<Markdown>{content}</Markdown>
+
+<!-- external with newlines -->
+<Markdown>
+ {content}
+</Markdown>
+
+ <!-- external with indentation -->
+ <Markdown>
+ {content}
+ </Markdown>