Giter Site home page Giter Site logo

Comments (8)

sorrycc avatar sorrycc commented on April 28, 2024

[$demo](./demo/Hello.jsx)

from dumi.

sorrycc avatar sorrycc commented on April 28, 2024
`$demo: ./demo/Hello.jsx`

from dumi.

PeachScript avatar PeachScript commented on April 28, 2024

[$demo](./demo/Hello.jsx)

@sorrycc 这个方案是否容易与用户的内容冲突,假设用户需要描述自己的一个内置变量,正好叫 $demo,然后锚点链接过去的话

from dumi.

vthinkxie avatar vthinkxie commented on April 28, 2024

<!-- [demo=./demo/Hello.jsx]-->

from dumi.

hstarorg avatar hstarorg commented on April 28, 2024

$[demo标题](./demo/Hello.jsx) ,参考图片标签 ![图片alt](图片地址), 也就是方案2。中括号可以当成 demo 标题

from dumi.

rdmclin2 avatar rdmclin2 commented on April 28, 2024

原来的 mdx 语法是支持复杂demo嵌入的,如

import demo1 from './demo1';

<Playground>
   <demo1 />
</Playground>

但是这种方式有个问题是实际用户看不到demo里面的代码,也无法修改,如果能够修正这个问题,我想用目前的方式也是ok的

from dumi.

PeachScript avatar PeachScript commented on April 28, 2024

@rdmclin2 是的,这也是一个方向,只是目前 father-doc 是基于 md 不是 mdx 的,主要考虑到 mdx 提供的便利性其实不比 md + 代码块 + 外部 demo 来得高

from dumi.

PeachScript avatar PeachScript commented on April 28, 2024

非常感谢各位提出的宝贵方案,在衡量当下和未来可能出现的需求后,决定采用 code 标签的方案,理由大概如下:

  1. code 标签本身是常规语法,即便在普通的 markdown 阅读器或者 GitHub 的 preview 时,也能够做到『降级显示』,比如 <code src="./Normal.jsx">标准模式使用示例</code> 在降级显示时会变成『标准模式使用示例』;
  2. code 作为 HTML 标签比较符合工程师的直觉;
  3. HTML 标签可以承载更多属性的配置,比如后续覆盖类似 ant.design 的文档场景时,可以启用 glob 和分栏属性以支持批量导入 demo 并分栏显示:<code src="./demo/*.jsx" cols="2">Button 组件的在线 demo</code>

from dumi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.