Skip to content

Commit dc59716

Browse files
committed
improve llms
1 parent 8e44be7 commit dc59716

File tree

4 files changed

+231
-7
lines changed

4 files changed

+231
-7
lines changed

docs/.vitepress/theme/blog-data.js

Lines changed: 159 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const posts = [
22
{
3-
"title": "Xmake v3.0.5 preview, Multi-row progress, XML module and Swift interop",
3+
"title": "Xmake v3.0.5 released, Multi-row progress, XML module and Swift interop",
44
"url": "/posts/xmake-update-v3.0.5",
55
"date": {
66
"time": 1763380800000,
@@ -16,7 +16,7 @@ export const posts = [
1616
"toolchain",
1717
"cuda"
1818
],
19-
"excerpt": "<p>In the new version, we have introduced several major features that significantly enhance the development experience. The highlights include <strong>multi-row progress output</strong> with theme support for better build visibility, a comprehensive <strong>XML module</strong> for parsing and encoding XML data, **asynchronous O...</p>\n<p>We have improved the progress output to support multi-row refresh, providing a significantly better visual experience during long-running builds. Instead of updating a single progress line, the build output now displays multiple concurrent build tasks with their individual progress, making it easier...</p>\n<p>The output now shows multiple progress lines for parallel builds with real-time status updates for each compilation task:</p>\n"
19+
"excerpt": "<p>In the new version, we have introduced several major features that significantly enhance the development experience. The highlights include <strong>multi-row progress output</strong> with theme support for better build visibility, a comprehensive <strong>XML module</strong> for parsing and encoding XML data, **asynchronous O...</p>\n<p><strong>Download:</strong> <a href=\"https://github.com/xmake-io/xmake/releases/tag/v3.0.5\">GitHub Releases</a> | <a href=\"https://github.com/xmake-io/xmake\">Source Repository</a></p>\n<p>We have improved the progress output to support multi-row refresh, providing a significantly better visual experience during long-running builds. Instead of updating a single progress line, the build output now displays multiple concurrent build tasks with their individual progress, making it easier...</p>\n"
2020
},
2121
{
2222
"title": "Xmake v2.9.1 released, Add native lua modules support",
@@ -724,6 +724,116 @@ export const posts = [
724724
],
725725
"excerpt": "<p>Xmake is a lightweight modern C/C++ project build tool based on Lua. Its main features are: easy to use syntax, more readable project maintenance, and a consistent build experience across platforms.</p>\n<p>This article mainly explains in detail how to load and run the compiled target program, and how to debug.</p>\n<ul>\n<li><a href=\"https://github.com/xmake-io/xmake\">Project Source</a></li>\n<li><a href=\"https://xmake.io/\">Official Documents</a></li>\n</ul>\n"
726726
},
727+
{
728+
"title": "Using Custom Build Rules in xmake",
729+
"url": "/posts/custom-rule",
730+
"date": {
731+
"time": 1510574400000,
732+
"string": "November 13, 2017"
733+
},
734+
"author": "Ruki",
735+
"tags": [
736+
"xmake",
737+
"lua",
738+
"custom rules"
739+
],
740+
"excerpt": "<p>After version 2.1.9, xmake not only natively supports building multiple language files, but also allows users to implement complex unknown file builds through custom build rules.</p>\n<p>For specific usage instructions, please refer to the relevant documentation: <a href=\"https://xmake.io/\">Rule Usage Manual</a></p>\n<p>We can extend build support for other files by pre-setting the file extensions supported by rules:</p>\n"
741+
},
742+
{
743+
"title": "Precompiled Header File Handling by Different Compilers",
744+
"url": "/posts/precompiled-header",
745+
"date": {
746+
"time": 1501502400000,
747+
"string": "July 31, 2017"
748+
},
749+
"author": "Ruki",
750+
"tags": [
751+
"xmake",
752+
"lua",
753+
"precompiled headers",
754+
"c++ compilation acceleration",
755+
"optimization compilation",
756+
"cross-platform"
757+
],
758+
"excerpt": "<p>Recently, in order to implement precompiled header file support for <a href=\"https://xmake.io\">xmake</a>, I studied the mechanisms and differences of how major mainstream compilers handle precompiled headers.</p>\n<p>Most c/c++ compilers now support precompiled headers, such as: gcc, clang, msvc, etc., to optimize c++ code compilation speed. After all, if c++ header files contain template definitions, compilation speed is very slow. If most common header files can be placed in a <code>header.h</code> and precompiled before...</p>\n<p>However, different compilers have different levels of support and handling methods for it, and it's not very universal. It took a lot of effort to encapsulate it into a unified interface and usage method in xmake.</p>\n"
759+
},
760+
{
761+
"title": "xmake Description Syntax and Scope Explained",
762+
"url": "/posts/api-scope",
763+
"date": {
764+
"time": 1477483200000,
765+
"string": "October 26, 2016"
766+
},
767+
"author": "Ruki",
768+
"tags": [
769+
"xmake",
770+
"api",
771+
"project description",
772+
"scope"
773+
],
774+
"excerpt": "<p>Although xmake's project description file <code>xmake.lua</code> is based on lua syntax, xmake has wrapped it with an additional layer to make writing project build logic more convenient and concise, so that writing <code>xmake.lua</code> won't be as tedious as writing makefiles.</p>\n<p>Basically, writing a simple project build description only takes three lines, for example:</p>\n<pre><code class=\"language-lua\">target(&quot;test&quot;)\n set_kind(&quot;binary&quot;)\n add_files(&quot;src/*.c&quot;)\n</code></pre>\n"
775+
},
776+
{
777+
"title": "Using Built-in Variables and External Variables in xmake",
778+
"url": "/posts/variables-usage",
779+
"date": {
780+
"time": 1470657600000,
781+
"string": "August 8, 2016"
782+
},
783+
"author": "Ruki",
784+
"tags": [
785+
"xmake",
786+
"built-in variables",
787+
"external variables"
788+
],
789+
"excerpt": "<p>Embedded in strings, for example:</p>\n<pre><code class=\"language-lua\"> set_objectdir(&quot;$(buildir)/.objs&quot;)\n</code></pre>\n<p>Among them, <code>$(buildir)</code> is a built-in variable. These automatically change as the configuration changes with each <code>xmake config</code>.</p>\n"
790+
},
791+
{
792+
"title": "Advanced Feature: Custom Options",
793+
"url": "/posts/custom-option",
794+
"date": {
795+
"time": 1470571200000,
796+
"string": "August 7, 2016"
797+
},
798+
"author": "Ruki",
799+
"tags": [
800+
"xmake",
801+
"custom options"
802+
],
803+
"excerpt": "<p>xmake can also support some custom option switches, making projects support optional compilation and facilitating modular project management.</p>\n<p>Let's take a practical example:</p>\n<p>We want to add a new switch option called <code>hello</code> to our project. If this switch is enabled, it will add some specific source files to the target, but this switch is disabled by default and needs to be linked and used by configuring <code>xmake f --hello=true</code>.</p>\n"
804+
},
805+
{
806+
"title": "Adding Dependencies and Auto-detection Mechanism",
807+
"url": "/posts/add-package-and-autocheck",
808+
"date": {
809+
"time": 1470484800000,
810+
"string": "August 6, 2016"
811+
},
812+
"author": "Ruki",
813+
"tags": [
814+
"xmake",
815+
"dependencies",
816+
"auto-detection"
817+
],
818+
"excerpt": "<p>xmake encapsulates dependency libraries, dependency headers, dependency types, and dependency interfaces uniformly using the option mechanism, and further introduces a package mechanism at a higher level, making adding and detecting dependencies more modular and simpler.</p>\n<p>Let's look at how xmake's package mechanism works through a specific example.</p>\n<p>Suppose your project already has two packages: <code>zlib.pkg</code> and <code>polarssl.pkg</code> (how to build packages will be explained in detail later; for now, you can refer to the examples of existing packages in <a href=\"https://github.com/waruqi/tbox/tree/master/pkg\">TBOX dependencies</a>). Your project directory structure...</p>\n"
819+
},
820+
{
821+
"title": "Selective Compilation in xmake Project Description",
822+
"url": "/posts/condition-and-select-compile",
823+
"date": {
824+
"time": 1469275200000,
825+
"string": "July 23, 2016"
826+
},
827+
"author": "Ruki",
828+
"tags": [
829+
"xmake",
830+
"compilation",
831+
"project description",
832+
"xmake.lua",
833+
"conditional judgment"
834+
],
835+
"excerpt": "<p>xmake provides some built-in conditional judgment APIs for obtaining relevant information about project status during selective compilation to adjust compilation logic.</p>\n<p>For example: <code>is_os</code>, <code>is_plat</code>, <code>is_arch</code>, <code>is_kind</code>, <code>is_mode</code>, <code>is_option</code></p>\n<p>Let's first talk about how to use the most commonly used <code>is_mode</code>. This API is mainly used to judge the current compilation mode. For example, when configuring compilation normally, you will execute:</p>\n"
836+
},
727837
{
728838
"title": "How to complie project using the cross-toolchains",
729839
"url": "/posts/how-to-compile-on-cross-toolchains",
@@ -786,5 +896,52 @@ export const posts = [
786896
"package"
787897
],
788898
"excerpt": "<p>Packages all targets for the current platform:</p>\n<pre><code class=\"language-bash\"> $xmake p\n $xmake package\n</code></pre>\n<p>Packages the target test to the output directory: /tmp</p>\n"
899+
},
900+
{
901+
"title": "Plugin Development: Import Libraries",
902+
"url": "/posts/api-import",
903+
"date": {
904+
"time": 1465473600000,
905+
"string": "June 9, 2016"
906+
},
907+
"author": "Ruki",
908+
"tags": [
909+
"xmake",
910+
"plugin",
911+
"import",
912+
"library",
913+
"custom script"
914+
],
915+
"excerpt": "<p><code>import</code> is mainly used to import xmake's extension libraries and some custom library modules. It is generally used in custom scripts (<code>on_build</code>, <code>on_run</code> ..), plugin development, template development, platform extensions, custom tasks, etc.</p>\n<p>The import mechanism is as follows:</p>\n<ol>\n<li>First import from the current script directory</li>\n<li>Then import from extension libraries</li>\n</ol>\n"
916+
},
917+
{
918+
"title": "Advanced Feature: Custom Task",
919+
"url": "/posts/custom-task",
920+
"date": {
921+
"time": 1465473600000,
922+
"string": "June 9, 2016"
923+
},
924+
"author": "Ruki",
925+
"tags": [
926+
"xmake",
927+
"task",
928+
"custom script",
929+
"plugin"
930+
],
931+
"excerpt": "<p><code>task</code> is a new feature starting from xmake 2.0 and is also the core of plugin development. In <a href=\"https://xmake.io/\">Plugin Development: Hello xmake</a> we briefly introduced the definition and usage of tasks.</p>\n<p>Of course, tasks can not only be used to write plugins, but also to write some simple custom tasks.</p>\n<p>Let's first look at a simple task implementation:</p>\n"
932+
},
933+
{
934+
"title": "Introduction to xmake Project Description",
935+
"url": "/posts/project-description",
936+
"date": {
937+
"time": 1454500800000,
938+
"string": "February 3, 2016"
939+
},
940+
"author": "Ruki",
941+
"tags": [
942+
"xmake",
943+
"premake"
944+
],
945+
"excerpt": "<p>xmake's project description file abandons the tedious complexity of makefiles, learns from premake's simplicity and clarity, and natively supports lua scripts, making it more flexible and convenient to extend.</p>\n<p>The default project description file name is <code>xmake.lua</code>, which supports multi-level directory nesting. You can also specify other files as project description files through the following commands:</p>\n<pre><code class=\"language-bash\"> xmake -f /tmp/xxx.lua\n xmake --file=xxx.lua\n</code></pre>\n"
789946
}
790947
]

docs/.vitepress/theme/zh-blog-data.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const posts = [
22
{
3-
"title": "Xmake v3.0.5 预览:多行进度输出、XML 模块、异步 OS API 和 Swift 互操作",
3+
"title": "Xmake v3.0.5 发布:多行进度输出、XML 模块、异步 OS API 和 Swift 互操作",
44
"url": "/zh/posts/xmake-update-v3.0.5",
55
"date": {
66
"time": 1763380800000,
@@ -16,7 +16,7 @@ export const posts = [
1616
"toolchain",
1717
"cuda"
1818
],
19-
"excerpt": "<p>新版本中,我们引入了多个重要特性,显著提升了开发体验。重点包括<strong>多行进度输出</strong>(支持主题配置,提供更好的构建可见性)、全面的<strong>XML 模块</strong>(用于解析和编码 XML 数据)、<strong>异步 OS API</strong>(提升 I/O 性能)以及<strong>Swift 互操作支持</strong>(实现 Swift 与 C++/Objective-C 代码的无缝集成)。同时,我们也对工具链配置、TTY 处理进行了重大改进,并进行了各种性能优化。</p>\n<p>我们改进了进度输出,支持多行刷新,在长时间运行的构建过程中提供显著更好的视觉体验。构建输出现在不再只更新单行进度,而是显示多个并发构建任务及其各自的进度,使得监控并行编译变得更加容易。</p>\n<p>输出现在显示并行构建的多行进度,每个编译任务都有实时状态更新:</p>\n"
19+
"excerpt": "<p>新版本中,我们引入了多个重要特性,显著提升了开发体验。重点包括<strong>多行进度输出</strong>(支持主题配置,提供更好的构建可见性)、全面的<strong>XML 模块</strong>(用于解析和编码 XML 数据)、<strong>异步 OS API</strong>(提升 I/O 性能)以及<strong>Swift 互操作支持</strong>(实现 Swift 与 C++/Objective-C 代码的无缝集成)。同时,我们也对工具链配置、TTY 处理进行了重大改进,并进行了各种性能优化。</p>\n<p><strong>下载地址:</strong> <a href=\"https://github.com/xmake-io/xmake/releases/tag/v3.0.5\">GitHub Releases</a> | <a href=\"https://github.com/xmake-io/xmake\">源码仓库</a></p>\n<p>我们改进了进度输出,支持多行刷新,在长时间运行的构建过程中提供显著更好的视觉体验。构建输出现在不再只更新单行进度,而是显示多个并发构建任务及其各自的进度,使得监控并行编译变得更加容易。</p>\n"
2020
},
2121
{
2222
"title": "Xmake v2.9.1 发布,新增 native lua 模块和鸿蒙系统支持",

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
"type": "module",
33
"scripts": {
44
"docs:dev": "node scripts/generate-blog-data.js && vitepress dev docs",
5-
"docs:build": "node scripts/generate-blog-data.js && vitepress build docs",
5+
"docs:build": "node scripts/generate-blog-data.js && vitepress build docs && node scripts/fix-llms-txt.cjs",
66
"docs:preview": "vitepress preview docs",
77
"generate-blog": "node scripts/generate-blog-data.js"
88
},
99
"devDependencies": {
10-
"glob": "^11.0.3",
10+
"glob": "^11.1.0",
1111
"gray-matter": "^4.0.3",
1212
"markdown-it": "^14.1.0",
1313
"vitepress": "^2.0.0-alpha.6",
1414
"vitepress-plugin-group-icons": "^1.6.5",
15-
"vitepress-plugin-llms": "^1.9.2"
15+
"vitepress-plugin-llms": "^1.9.3"
1616
}
1717
}

scripts/fix-llms-txt.cjs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const distDir = path.join(__dirname, '../docs/.vitepress/dist');
5+
const files = ['llms.txt', 'llms-full.txt'];
6+
7+
function cleanTitle(title) {
8+
// Remove markdown anchors like {#...}
9+
let cleaned = title.replace(/\s*\{#[^}]+\}\s*/g, '');
10+
11+
// Decode HTML entities (basic ones)
12+
cleaned = cleaned.replace(/&#x20;/g, ' ')
13+
.replace(/&lt;/g, '<')
14+
.replace(/&gt;/g, '>')
15+
.replace(/&amp;/g, '&')
16+
.replace(/&quot;/g, '"')
17+
.replace(/&apos;/g, "'");
18+
19+
return cleaned.trim();
20+
}
21+
22+
function processFile(filename) {
23+
const filePath = path.join(distDir, filename);
24+
if (!fs.existsSync(filePath)) {
25+
console.log(`File not found: ${filePath}`);
26+
return;
27+
}
28+
29+
let content = fs.readFileSync(filePath, 'utf8');
30+
31+
// Fix TOC titles in format: - [Title](link)
32+
// We match the line starting with - [
33+
content = content.replace(/^-\s+\[(.*?)\]\((.*?)\)/gm, (match, title, link) => {
34+
const newTitle = cleanTitle(title);
35+
return `- [${newTitle}](${link})`;
36+
});
37+
38+
// Also fix titles in the content (for llms-full.txt)
39+
// Titles usually start with #
40+
// e.g. # 安装卸载 {#install-and-uninstall}
41+
content = content.replace(/^(#+)\s+(.*?)(\s+\{#[^}]+\})?\s*$/gm, (match, hashes, title, anchor) => {
42+
// If it's a header, we also want to clean the title part
43+
// But wait, the anchor in header is actually useful for linking?
44+
// In llms-full.txt, we might want to keep the header as is, or maybe clean it too?
45+
// The user complaint was "garbled", which likely refers to the messy text.
46+
// For headers in full text, keeping anchor is fine as it defines the ID.
47+
// But looking at llms-full.txt content:
48+
// # 安装卸载 {#install-and-uninstall}
49+
// This is standard markdown header with ID. It is NOT garbled.
50+
51+
// However, the TOC in llms.txt has:
52+
// - [安装卸载 {#install-and-uninstall}](/zh/guide/basic-commands/install-and-uninstall.md)
53+
// This looks messy in a list of links.
54+
55+
return match; // Don't change headers in content for now, unless requested.
56+
});
57+
58+
// Add BOM if not present
59+
if (!content.startsWith('\uFEFF')) {
60+
content = '\uFEFF' + content;
61+
}
62+
63+
fs.writeFileSync(filePath, content, 'utf8');
64+
console.log(`Fixed ${filename}`);
65+
}
66+
67+
files.forEach(processFile);

0 commit comments

Comments
 (0)