jlak 最近的时间轴更新
jlak

jlak

V2EX 第 296573 号会员,加入于 2018-03-05 03:16:14 +08:00
今日活跃度排名 23858
根据 jlak 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
jlak 最近回复了
1 天前
回复了 lilistar9999 创建的主题 求职 成都前端 本科 2 年 求捞
排版颜色间距对比啥都是问题,槽点太多了
看到 3899 的电脑 涨到 4999 然后国补后 3999
36 天前
回复了 zwpaper 创建的主题 分享创造 一觉醒来, HackerNews 上前三了
这种是不是很吃 token
38 天前
回复了 jlak 创建的主题 问与答 请问 next.js 里如何好好渲染 md
@scienhub tw 会删除所有默认样式,用 @ tailwindcss/typography 插件后好多了
38 天前
回复了 jlak 创建的主题 问与答 请问 next.js 里如何好好渲染 md
找到元凶了,是 TailwindCSS 去掉了所有样式,删除 TailwindCSS 后正常了,但又不能不用 TailwindCSS
38 天前
回复了 jlak 创建的主题 问与答 请问 next.js 里如何好好渲染 md
38 天前
回复了 jlak 创建的主题 问与答 请问 next.js 里如何好好渲染 md
Reply 6
jlak
OP
刚刚
新弄了一套 还是丑 空行都消失了
```javascript
import { MDXRemote } from "next-mdx-remote/rsc";
import matter from "gray-matter";
import remarkGfm from "remark-gfm";
export default async function Test3() {
const data = await fetch(
"https://raw.githubusercontent.com/onwidget/astrowind/refs/heads/main/src/data/post/landing.md"
);
const text = await data.text();
const { content } = matter(text);

const mdxOptions = {
mdxOptions: {
remarkPlugins: [remarkGfm],
},
};

const components = {
h1: ({ children }: { children: React.ReactNode }) => (
<h1 className="text-3xl font-bold text-red-500">{children}</h1>
),
p: ({ children }: { children: React.ReactNode }) => (
<p className="text-lg text-gray-700">{children}</p>
),
a: ({ children, href }: { children: React.ReactNode; href: string }) => (
<a href={href} className="text-blue-500 hover:underline">
{children}
</a>
),
ul: ({ children }: { children: React.ReactNode }) => (
<ul className="list-disc list-inside text-gray-700">{children}</ul>
),
li: ({ children }: { children: React.ReactNode }) => (
<li className="text-gray-700">{children}</li>
),
code: ({ children }: { children: React.ReactNode }) => (
<code className="text-gray-700">{children}</code>
),
blockquote: ({ children }: { children: React.ReactNode }) => (
<blockquote className="text-gray-700">{children}</blockquote>
),
table: ({ children }: { children: React.ReactNode }) => (
<table className="text-gray-700">{children}</table>
),
tr: ({ children }: { children: React.ReactNode }) => (
<tr className="text-gray-700">{children}</tr>
),
td: ({ children }: { children: React.ReactNode }) => (
<td className="text-gray-700">{children}</td>
),
};

return (
<div className="container mx-auto p-4">
<MDXRemote
source={content}
options={mdxOptions}
components={components}
/>
</div>
);
}
38 天前
回复了 jlak 创建的主题 问与答 请问 next.js 里如何好好渲染 md
新弄了一套 还是丑 空行都消失了
```javascript
import { MDXRemote } from "next-mdx-remote/rsc";
import matter from "gray-matter";
import remarkGfm from "remark-gfm";
export default async function Test3() {
const data = await fetch(
"https://raw.githubusercontent.com/onwidget/astrowind/refs/heads/main/src/data/post/landing.md"
);
const text = await data.text();
const { content } = matter(text);

const mdxOptions = {
mdxOptions: {
remarkPlugins: [remarkGfm],
},
};

const components = {
h1: ({ children }: { children: React.ReactNode }) => (
<h1 className="text-3xl font-bold text-red-500">{children}</h1>
),
p: ({ children }: { children: React.ReactNode }) => (
<p className="text-lg text-gray-700">{children}</p>
),
a: ({ children, href }: { children: React.ReactNode; href: string }) => (
<a href={href} className="text-blue-500 hover:underline">
{children}
</a>
),
ul: ({ children }: { children: React.ReactNode }) => (
<ul className="list-disc list-inside text-gray-700">{children}</ul>
),
li: ({ children }: { children: React.ReactNode }) => (
<li className="text-gray-700">{children}</li>
),
code: ({ children }: { children: React.ReactNode }) => (
<code className="text-gray-700">{children}</code>
),
blockquote: ({ children }: { children: React.ReactNode }) => (
<blockquote className="text-gray-700">{children}</blockquote>
),
table: ({ children }: { children: React.ReactNode }) => (
<table className="text-gray-700">{children}</table>
),
tr: ({ children }: { children: React.ReactNode }) => (
<tr className="text-gray-700">{children}</tr>
),
td: ({ children }: { children: React.ReactNode }) => (
<td className="text-gray-700">{children}</td>
),
};

return (
<div className="container mx-auto p-4">
<MDXRemote
source={content}
options={mdxOptions}
components={components}
/>
</div>
);
}
```
38 天前
回复了 jlak 创建的主题 问与答 请问 next.js 里如何好好渲染 md
@wunonglin md 什么样式?
https://dillinger.io 我是这里复制过来的,也复制了其他的和 ai 写的,都一样
我 api 写入数据库 再读区数据库的

@Track13 连空行都消失了 这也是样式关系吗
38 天前
回复了 jlak 创建的主题 问与答 请问 next.js 里如何好好渲染 md
@scienhub
我用的 next-mdx-remote/rsc 官网的文档不一样
remark-gfm 加入区别不大,很细的变化
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1150 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms · UTC 23:21 · PVG 07:21 · LAX 15:21 · JFK 18:21
Developed with CodeLauncher
♥ Do have faith in what you're doing.