zce / velite

Turns Markdown / MDX, YAML, JSON, or others into app's data layer with Zod schema.
http://velite.js.org
MIT License
476 stars 23 forks source link

[Feature Request] s.excerpt({ separator: 'preview' }) #206

Closed track23 closed 2 months ago

track23 commented 2 months ago

Here is the translation:

I noticed this part of the code is commented out. Was there a consideration to add this feature?

My blog heavily relies on this functionality, which prevents me from migrating to Velite.

Is it possible to pass the return value of s.excerpt() to s.mdx()? If not, I'll have to process it with mdx.compile in the transform, but that's quite cumbersome.


我发现代码中注释了这部分,是否有考虑添加这个功能? 我的博客很依赖这个功能,这让我没办法迁移到velite。 s.excerpt()的返回值能传递给s.mdx()吗?如果不能,那我只能在transform中使用mdx的compile进行处理,但这样太麻烦了。

zce commented 2 months ago

Since most of the time the excerpt is just plain text, I would like it to be simpler.

If you need rich text blog preview, you need to implement a custom schema

track23 commented 2 months ago

Is it possible to export markdown and mdx as public methods, allowing users to utilize them within the transform? This is because these two methods involve path rewriting for resources like images. If users implement content compilation themselves, they would need to handle path rewriting manually.

zce commented 2 months ago

This is possible now, I have exported the built-in related plugins, and can also provide transformed mdast and hast through the transform context.

If necessary I can provide an example when I have time.

track23 commented 2 months ago

I've seen that Velite exports remarkCopyLinkedFiles, and I've successfully used it in MDX. This library is great, and I hope it continues to be maintained.