docs: add native doc-viewer and widget documentation#324
Conversation
|
@copilot PR 标题应该概述本次实施计划(我已手动更新标题,你无需再修改),PR 描述应该简单说明这次 PR 做了什么,而不是写你修改了什么。后续对此 PR 做修改不要重置 PR 标题和描述,应该仅对 PR 描述做完善和补充。 |
了解,后续不会重置 PR 标题和描述,仅对描述做补充说明,描述内容也会聚焦在"这次 PR 做了什么"上。 |
|
@copilot 重写 PR 描述吧,现在的内容被你重置成仅针对 PR 评审的改动了。 |
| run: npm install @lcui/react | ||
|
|
||
| - name: Process TSX files | ||
| run: lcui build docs/build/app |
| - name: Build LCUI | ||
| run: | | ||
| xmake config -y -v -k static -m release | ||
| xmake |
There was a problem hiding this comment.
Build LCUI 步骤不应该编译 docs-viewer,相关日志如下:
[ 13%]: <lcui> compiling.release src/widgets/scrollbar.c
[ 13%]: <lcui> compiling.release src/widgets/textcaret.c
error: src/main.h:4:10: fatal error: ../docs/build/app/components/anchor/page.h: No such file or directory
4 | #include "../docs/build/app/components/anchor/page.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
> in src/main.c
Error: Process completed with exit code 255.
There was a problem hiding this comment.
@copilot 你应该主动在你的开发环境内执行一遍构建流程,而不是让 GitHub Actions 帮你构建和测试。
There was a problem hiding this comment.
已删除 src/main.c 和 src/main.h——这两个文件原本是 docs-viewer 的入口文件,被错误放置在 src/ 目录下,导致 LCUI 的 add_files("src/**.c") 将其编译时引用了不存在的 docs 头文件。删除后 Build LCUI 步骤不再编译 docs-viewer 相关代码。
| # Build the docs-viewer C executable (Windows) | ||
| # --------------------------------------------------------------------------- | ||
| build-viewer-windows: | ||
| name: Build docs-viewer (Windows) |
There was a problem hiding this comment.
看上去 windows 和 linux 下的 docs-viewer 构建步骤是相似的,应该参考 ccpp.yml 用 matrix:
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'windows-latest']There was a problem hiding this comment.
已将两个 build-viewer job 合并为使用 matrix 策略(ubuntu-latest + windows-latest),与 ccpp.yml 保持一致。
已根据最新审核意见完成修改(提交 |
|
@copilot 按下面的方案调整。 删减示例所有组件示例只保留基础示例,移除其它示例。 文档内容规范减少表格的使用,因为 LCUI 不支持 table 布局。如果确实需要用到表格,应该在转译阶段将其转换成用 flex 布局容器模拟实现,即:每行对应一个 flex 容器,每列宽度是固定值/百分比值,最多一列是 flex-auto 自动填充可用宽度。 tools/doc-viewer 项目
文档转译约定:
流程:
|
... 已按方案完成调整(提交
|
7418aff to
db84ce2
Compare
|
@copilot 按照以下评审意见做修改。 tools\doc-viewer\app\components\sidebar.json:应该支持多语言。 tools\doc-viewer\app\components\sidebar.tsx:
tools\doc-viewer\app\components\navbar.tsx:
tools\doc-viewer\app\handbook\composition\page.tsx:
tools\doc-viewer\app\components\button\page.tsx:
tools\doc-viewer\app\components\button\page.c: 怎么是在页面初始化函数里写 C 代码构造示例代码块啊?这些属于静态内容,应该由 tsx 文件描述。 docs\examples\button-basic-tsx\ui.tsx: 更名为 example.tsx,其他组件示例目录内的 ui.tsx 也做相同的重命名。 docs\examples\button-basic-tsx\main.c: 内容改为: #include <LCUI.h>
#include "example.h"
int main(int argc, char *argv[])
{
lcui_init();
ui_register_example();
ui_root_append(ui_create_example());
return lcui_main();
}其他组件的 tsx 示例中的 main.c 内容也改成这样。 |
已按评审意见完成修改:
本地已验证 |
df664b8 to
427939a
Compare
cd3ff82 to
1e29687
Compare
1e29687 to
eb2dc6f
Compare
- Add examples/doc-viewer, an LCUI-based documentation viewer with an MDX compiler pipeline that converts source MDX files into C/TSX page components rendered by lcui build. - Add zh-CN and en documentation for 5 widgets (anchor, button, scrollarea, text, text-input), each with C/TSX/XML example variants and widget-fields data. - Add handbook and overview documentation.
Adds an LCUI-based documentation viewer (examples/doc-viewer/) with an MDX
compiler pipeline that converts source MDX files into C/TSX page components.
Includes:
with C/TSX/XML example variants and widget-fields data
The MDX compiler (examples/doc-viewer/scripts/compiler/) supports inline
code formatting, fenced code blocks with title metadata, admonition containers,
flexboxed table rendering, and locale-aware routing.