Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove error message for using Markdown component #7343

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/modern-turkeys-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/markdown-component': patch
---

Fix Markdown component error message false positive
8 changes: 1 addition & 7 deletions packages/markdown/component/Markdown.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ export interface Props {
content?: string;
}

// NOTE(fks): We are most likely moving this component out of Astro core
// in a few weeks. Checking the name like this is a bit of a hack, but we
// intentionally don't want to add an SSR flag for others to read from, just yet.
if (Astro.redirect.name !== '_onlyAvailableInSSR') {
console.error(`\x1B[31mThe <Markdown> component is not available in SSR. See https://github.com/withastro/rfcs/discussions/179 for more info.\x1B[39m`);
}

const dedent = (str: string) => {
const _str = str.split('\n').filter(s => s.trimStart().length > 0);
if (_str.length === 0) {
Expand All @@ -24,6 +17,7 @@ const dedent = (str: string) => {

// Internal props that should not be part of the external interface.
interface InternalProps extends Props {
class: string;
$scope: string;
}

Expand Down