-
Notifications
You must be signed in to change notification settings - Fork 132
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
[Bug]: ID is missing when the title is used with the component #1361
Comments
Try to write |
😀明天试一下这个 |
import { Root } from "../../types/textTypes";
interface Props {
text: string;
vocabulary: Root["vocabulary"];
}
const textContrast = (a: string, b: string) => {
return new RegExp(a, "i").test(b);
};
/**
* 输出文本,如果包含本课的新词会重点描述
* @param param0
*/
export const TextVocabularyOutput: React.FC<Props> = ({ text, vocabulary }) => {
const arr = text
.split(/\s/g)
.map((item, index, array) => {
const isEnd = array.length === index - 1;
const text = isEnd ? "" : " ";
if (vocabulary.find((f) => textContrast(f.word, item))) {
return [<span key={item}>{item}</span>, text];
}
return [item, text];
})
.flat(2);
return <># {arr}</>;
}; 在mdx中如果这样调用 # Lesson 1 Excuse me! 对不起!
<TextVocabularyOutput text={data.title} vocabulary={data.vocabulary} /> 输出 |
If you using The tsx component should not be used to generate markdown headers and more dynamic markdown/html structures, which will lack a lot of metadata information when analyzing at build time. The correct usage of the tsx component should be to write a component written by react that not return markdown structure. If you use the original method in your issue screenshot, the |
版本信息
System: OS: macOS 14.6.1 CPU: (8) arm64 Apple M1 Pro Memory: 76.27 MB / 16.00 GB Shell: 5.9 - /bin/zsh Browsers: Chrome: 128.0.6613.85 Safari: 17.6 npmPackages: rspress: ^1.28.0 => 1.28.2
问题详情
复现链接
none
复现步骤
不需要
The text was updated successfully, but these errors were encountered: