Skip to content

Commit

Permalink
feat: support Image builtin component and fix table style
Browse files Browse the repository at this point in the history
  • Loading branch information
Carrotzpc committed Aug 22, 2024
1 parent 28ff7d3 commit 1568c17
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
16 changes: 16 additions & 0 deletions example/docs/config/markdown.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,19 @@ tag:
tag: New
---
```

## 图片组件 Image

```md
<Image
src="https://gw.alipayobjects.com/zos/kitchen/sLO%24gbrQtp/lobe-chat.webp"
/>
```

图片则渲染为 (支持图片集):

<Image
src="https://gw.alipayobjects.com/zos/kitchen/sLO%24gbrQtp/lobe-chat.webp"
/>

<Image src="https://gw.alipayobjects.com/zos/kitchen/8Ab%24hLJ5ur/cover.webp" />
1 change: 1 addition & 0 deletions src/builtins/Image/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Image as default } from '@lobehub/ui';
10 changes: 10 additions & 0 deletions src/layouts/DocLayout/GlobalStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ const GlobalStyle = createGlobalStyle`
display: none;
}
}
.dumi-default-table {
&-content {
table {
display: table;
table-layout: auto;
width: 100%;
}
}
}
`;

export default GlobalStyle;
4 changes: 2 additions & 2 deletions src/pages/Docs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StyleProvider } from '@ant-design/cssinjs';
import { Giscus } from '@lobehub/ui';
import { Giscus, ImageGallery } from '@lobehub/ui';
import { useLocation, useOutlet } from 'dumi';
import { memo, useCallback, useEffect } from 'react';
import { Center } from 'react-layout-kit';
Expand Down Expand Up @@ -54,7 +54,7 @@ const Documents = memo(() => {
</div>
) : undefined}
<Content>
{outlet}
<ImageGallery>{outlet}</ImageGallery>
{giscus && <Comment />}
</Content>
</Center>
Expand Down

0 comments on commit 1568c17

Please sign in to comment.