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

fix(mdx-loader): improve mdxJsxTextElementToHtml #9262

Merged
merged 3 commits into from
Aug 25, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
TS fixes
  • Loading branch information
slorber committed Aug 25, 2023
commit 1d26a47b4929c5e7e5c1ab691fb5fe29c592c70a
4 changes: 2 additions & 2 deletions packages/docusaurus-mdx-loader/src/remark/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import escapeHtml from 'escape-html';
import type {Parent} from 'unist';
import type {PhrasingContent, Heading} from 'mdast';
// @ts-expect-error: TODO see https://github.com/microsoft/TypeScript/issues/49721
import type {
MdxJsxAttribute,
MdxJsxAttributeValueExpression,
MdxJsxTextElement,
// @ts-expect-error: TODO see https://github.com/microsoft/TypeScript/issues/49721
} from 'mdast-util-mdx';

export function stringifyContent(
Expand Down Expand Up @@ -42,7 +42,7 @@ function mdxJsxTextElementToHtml(
attributes.find((attr) => attr.name === 'class');

const classAttributeString = classAttribute
? `class="${escapeHtml(classAttribute.value)}"`
? `class="${escapeHtml(String(classAttribute.value))}"`
: ``;

const allAttributes = classAttributeString ? ` ${classAttributeString}` : '';
Expand Down
Loading