Comments (9)
@natemoo-re this seems to be caused by moving the markdown to the compiler. I don't see an obvious solution without reversing that (which I don't think we should do).
I'm also unsure of what should be expected here. In this case it's desirable to render the dynamic content but I can see cases where you don't want it to be rendered (to display the raw markdown code for example).
Perhaps we could support this via an attribute?
<Markdown content={content} />
from astro.
This is a regression! Thanks for filing, I'll take a look.
from astro.
Yep, this was definitely caused by moving the markdown to the compiler. We definitely shouldn't move it back to the runtime, but this behavior was a huge selling point of the Markdown
component, IMO.
I'm okay moving to a content
prop. That would cover "render this entire Markdown document" but sidestep some potentially thorny issues with dynamic content.
My thought is that the Markdown
component would POST content
to some path in /_astro_internal
which would act like an API route. It would return the rendered HTML. Bonus: we'd already have a hook into the user's astro.config.mjs
settings, so we can automatically use any configured plugins (when the time comes).
from astro.
Not sure I follow the API idea, what would be the reason to do it that way?
from astro.
Just an update here, #273 is a fix for this issue. It will be a breaking change however, as you'll now need to pass your dynamic markdown as an attribute. For example you can do:
---
import Markdown from 'astro/components/Markdown.astro';
const content = await fetch('https://raw.githubusercontent.com/snowpackjs/snowpack/main/README.md').then(res => res.text());
---
<Layout>
<Markdown>
## Markdown example
Here we have some __Markdown__ code. We can also dynamically render content from remote places.
<Markdown content={content} />
</Mardown>
</Layout>
This is to allow both static and dynamic markdown to be treated separately and compiled at the appropriate time (static is compiled at .astro compile time, dynamic at runtime).
from astro.
We will try that π
Released soon?
from astro.
It's out in 0.12.x. Closing this issue!
from astro.
Thanks team π
from astro.
There's another bug you might run into (will be obvious), which we should have a fix for shortly.
from astro.
Related Issues (20)
- Dependency Dashboard
- Vitest fails because of the ImageFunction helper (with content collections)
- [Bug]: WordPress Rest Api does not optimize images - set:html HOT 2
- "Browser APIs are not available on the server" error in `client:visible` component HOT 1
- Popup works as expected in dev mode but not in the build
- "Transition was aborted because of invalid state" coming form hoisted.*.js HOT 4
- files[normalizedPath] is not a function
- `@astrojs/lit` - `Module '"astro"' has no exported member 'AstroIntegration'.` HOT 1
- @astrojs/rss uses trailing slash in urls when it shouldn't HOT 1
- Add a new `Astro.metadata` global object HOT 6
- SVG rendering error - "unsupported file type" HOT 2
- VIewTransitions break on presence of <input name="action"> HOT 2
- cannot dev or preview a page, if the page filename contain 'index', eg. e-index.astro HOT 2
- onTouchStart not being attached to DOM elements when using jsx HOT 8
- Rendering React component does not work HOT 4
- `@astrojs/mdx`: βsmart quotesβ are broken in HTML headers HOT 2
- React hydration error with react table but works fine the same example in next.js HOT 2
- ViewTransitions breaking Radix/Shadcn ui Dropdown Functionality in Astro App HOT 7
- Relative paths in css url() references get double encoded HOT 4
- @astro/node gcloud [ERROR] TypeError: Error: Unexpected end of multipart data HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from astro.