aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--README.md20
-rw-r--r--doc/docs/.vitepress/theme/index.ts151
-rw-r--r--doc/docs/de/doc/getting-started/usage.md2
-rw-r--r--doc/docs/doc/getting-started/usage.md2
-rw-r--r--doc/docs/id-id/doc/getting-started/usage.md2
-rw-r--r--doc/docs/pt-br/doc/getting-started/usage.md2
-rw-r--r--doc/docs/zh/doc/getting-started/usage.md2
-rwxr-xr-xdoc/package.json2
-rw-r--r--doc/scripts/fix-css-link-rel.mjs32
-rw-r--r--doc/yue-de.md2
-rw-r--r--doc/yue-en.md2
-rw-r--r--doc/yue-id-id.md2
-rw-r--r--doc/yue-pt-br.md2
-rw-r--r--doc/yue-zh.md2
14 files changed, 171 insertions, 54 deletions
diff --git a/README.md b/README.md
index 57343cf..73fadf7 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
4 4
5[![IppClub](https://img.shields.io/badge/IppClub-Certified-11A7E2?logo=data%3Aimage%2Fsvg%2Bxml%3Bcharset%3Dutf-8%3Bbase64%2CPHN2ZyB2aWV3Qm94PSIwIDAgMjg4IDI3NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWw6c3BhY2U9InByZXNlcnZlIiBzdHlsZT0iZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjIiPjxwYXRoIGQ9Im0xNDYgMzEgNzIgNTVWMzFoLTcyWiIgc3R5bGU9ImZpbGw6I2Y2YTgwNjtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Im0xNjkgODYtMjMtNTUgNzIgNTVoLTQ5WiIgc3R5bGU9ImZpbGw6I2VmN2EwMDtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Ik0yNiAzMXY1NWg4MEw4MSAz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u.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/ubuntu.yml) [![Windows](https://github.com/pigpigyyy/Yuescript/actions/workflows/windows.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/windows.yml) [![macOS](https://github.com/pigpigyyy/Yuescript/actions/workflows/macos.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/macos.yml) [![Discord Badge](https://img.shields.io/discord/844031511208001577?color=5865F2&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/cRJ2VAm2NV) 5[![IppClub](https://img.shields.io/badge/IppClub-Certified-11A7E2?logo=data%3Aimage%2Fsvg%2Bxml%3Bcharset%3Dutf-8%3Bbase64%2CPHN2ZyB2aWV3Qm94PSIwIDAgMjg4IDI3NCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWw6c3BhY2U9InByZXNlcnZlIiBzdHlsZT0iZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjIiPjxwYXRoIGQ9Im0xNDYgMzEgNzIgNTVWMzFoLTcyWiIgc3R5bGU9ImZpbGw6I2Y2YTgwNjtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Im0xNjkgODYtMjMtNTUgNzIgNTVoLTQ5WiIgc3R5bGU9ImZpbGw6I2VmN2EwMDtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Ik0yNiAzMXY1NWg4MEw4MSAzMUgyNloiIHN0eWxlPSJmaWxsOiMwN2ExN2M7ZmlsbC1ydWxlOm5vbnplcm8iLz48cGF0aCBkPSJNMTA4IDkydjExMmwzMS00OC0zMS02NFoiIHN0eWxlPSJmaWxsOiNkZTAwNWQ7ZmlsbC1ydWxlOm5vbnplcm8iLz48cGF0aCBkPSJNMCAyNzR2LTUyaDk3bC0zM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QwWiIgc3R5bGU9ImZpbGw6IzdiMTI4NTtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Im0xMDggMjA0IDMxLTQ4aC0zMXY0OFoiIHN0eWxlPSJmaWxsOiNiYTAwNzc7ZmlsbC1ydWxlOm5vbnplcm8iLz48cGF0aCBkPSJtNjUgMjc0IDMzLTUySDBsNjUgNTJaIiBzdHlsZT0iZmlsbDojZWY3YTAwO2ZpbGwtcnVsZTpub256ZXJvIi8%2BPHBhdGggZD0iTTc3IDI3NGg2N2wtNDAtNDUtMjcgNDVaIiBzdHlsZT0iZmlsbDojYTgxZTI0O2ZpbGwtcnVsZTpub256ZXJvIi8%2BPHBhdGggZD0iTTE2NyAyMjJoNThsLTM0IDUyLTI0LTUyWiIgc3R5bGU9ImZpbGw6IzExYTdlMjtmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Im0yNzAgMjc0LTQ0LTUyLTM1IDUyaDc5WiIgc3R5bGU9ImZpbGw6IzA1N2NiNztmaWxsLXJ1bGU6bm9uemVybyIvPjxwYXRoIGQ9Ik0yNzUgNTVoLTU3VjBoMjV2MzFoMzJ2MjRaIiBzdHlsZT0iZmlsbDojZGUwMDVkO2ZpbGwtcnVsZTpub256ZXJvIi8%2BPHBhdGggZD0iTTE4NSAzMWg1N3Y1NWgtMjVWNTVoLTMyVjMxWiIgc3R5bGU9ImZpbGw6I2M1MTgxZjtmaWxsLXJ1bGU6bm9uemVybyIvPjwvc3ZnPg%3D%3D&labelColor=fff)](https://ippclub.org) [![Ubuntu](https://github.com/pigpigyyy/Yuescript/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/ubuntu.yml) [![Windows](https://github.com/pigpigyyy/Yuescript/actions/workflows/windows.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/windows.yml) [![macOS](https://github.com/pigpigyyy/Yuescript/actions/workflows/macos.yml/badge.svg)](https://github.com/pigpigyyy/Yuescript/actions/workflows/macos.yml) [![Discord Badge](https://img.shields.io/discord/844031511208001577?color=5865F2&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/cRJ2VAm2NV)
6 6
7YueScript is a MoonScript dialect. It is derived from [MoonScript language](https://github.com/leafo/moonscript) 0.5.0 and continuously adopting new features to be more up to date. 7YueScript is a MoonScript dialect. It is derived from [MoonScript language](https://github.com/leafo/moonscript) 0.5.0 and continuously adopting new features to be more up to date.
8 8
9MoonScript is a language that compiles to Lua. Since original MoonScript has been used to write web framework [lapis](https://github.com/leafo/lapis) and run a few business web sites like [itch.io](https://itch.io) and [streak.club](https://streak.club) with some large code bases. The original language is getting too hard to adopt new features for those may break the stablility for existing applications. 9MoonScript is a language that compiles to Lua. Since original MoonScript has been used to write web framework [lapis](https://github.com/leafo/lapis) and run a few business web sites like [itch.io](https://itch.io) and [streak.club](https://streak.club) with some large code bases. The original language is getting too hard to adopt new features for those may break the stablility for existing applications.
10 10
@@ -51,7 +51,7 @@ YueScript is being developed and maintained alongside the open-source game engin
51 51
52  Then require the YueScript module in Lua: 52  Then require the YueScript module in Lua:
53 53
54```Lua 54```lua
55require("yue")("main") -- require `main.yue` 55require("yue")("main") -- require `main.yue`
56 56
57local yue = require("yue") 57local yue = require("yue")
@@ -130,13 +130,15 @@ Options:
130 Execute without options to enter REPL, type symbol '$' 130 Execute without options to enter REPL, type symbol '$'
131 in a single line to start/stop multi-line mode 131 in a single line to start/stop multi-line mode
132``` 132```
133  Use cases: 133
134  Recursively compile every YueScript file with extension `.yue` under current path: `yue .` 134Use cases:
135  Compile and save results to a target path: `yue -t /target/path/ .` 135
136  Compile and reserve debug info: `yue -l .` 136* Recursively compile every YueScript file with extension `.yue` under current path: `yue .`
137  Compile and generate minified codes: `yue -m .` 137* Compile and save results to a target path: `yue -t /target/path/ .`
138  Execute raw codes: `yue -e 'print 123'` 138* Compile and reserve debug info: `yue -l .`
139  Execute a YueScript file: `yue -e main.yue` 139* Compile and generate minified codes: `yue -m .`
140* Execute raw codes: `yue -e 'print 123'`
141* Execute a YueScript file: `yue -e main.yue`
140 142
141 143
142 144
diff --git a/doc/docs/.vitepress/theme/index.ts b/doc/docs/.vitepress/theme/index.ts
index 7e9882e..4dd7408 100644
--- a/doc/docs/.vitepress/theme/index.ts
+++ b/doc/docs/.vitepress/theme/index.ts
@@ -1,7 +1,11 @@
1import DefaultTheme from "vitepress/theme"; 1import DefaultTheme from "vitepress/theme";
2import type { Theme } from "vitepress"; 2import type { Theme } from "vitepress";
3import { h } from "vue"; 3import { useRoute } from "vitepress";
4import { h, nextTick, watch } from "vue";
4import "./custom.css"; 5import "./custom.css";
6import darkPlus from "@shikijs/themes/dark-plus";
7import lightPlus from "@shikijs/themes/light-plus";
8import yuescriptGrammar from "../grammars/yuescript.tmLanguage.json";
5 9
6// @ts-ignore 10// @ts-ignore
7import CompilerModal from "./components/CompilerModal.vue"; 11import CompilerModal from "./components/CompilerModal.vue";
@@ -12,6 +16,134 @@ import YueCompiler from "./components/YueCompiler.vue";
12// @ts-ignore 16// @ts-ignore
13import YueDisplay from "./components/YueDisplay.vue"; 17import YueDisplay from "./components/YueDisplay.vue";
14 18
19type ShikiHighlighter = Awaited<
20 ReturnType<(typeof import("shiki/core"))["createHighlighterCore"]>
21>;
22
23let shikiHighlighterPromise: Promise<ShikiHighlighter> | null = null;
24let shikiRepairQueued = false;
25let shikiRepairRetry1 = 0;
26let shikiRepairRetry2 = 0;
27
28type SupportedLanguage = "yuescript" | "lua" | "shellscript";
29
30function toSupportedLanguage(className: string): SupportedLanguage | null {
31 const match = className.match(/(?:^|\s)language-([a-z0-9_-]+)/i);
32 if (!match) return null;
33 const lang = match[1].toLowerCase();
34 if (lang === "yuescript" || lang === "yue") return "yuescript";
35 if (lang === "lua") return "lua";
36 if (
37 lang === "shellscript" ||
38 lang === "shell" ||
39 lang === "bash" ||
40 lang === "sh" ||
41 lang === "zsh"
42 ) {
43 return "shellscript";
44 }
45 return null;
46}
47
48function getShikiHighlighter() {
49 if (!shikiHighlighterPromise) {
50 shikiHighlighterPromise = Promise.all([
51 import("shiki/core"),
52 import("shiki/engine/javascript"),
53 import("@shikijs/langs/lua"),
54 import("@shikijs/langs/shellscript"),
55 ]).then(
56 ([
57 { createHighlighterCore },
58 { createJavaScriptRegexEngine },
59 luaLang,
60 shellscriptLang,
61 ]) =>
62 createHighlighterCore({
63 themes: [lightPlus, darkPlus],
64 langs: [
65 {
66 ...yuescriptGrammar,
67 name: "yuescript",
68 scopeName: "source.yuescript",
69 aliases: ["yue"],
70 },
71 ...luaLang.default,
72 ...shellscriptLang.default,
73 ],
74 engine: createJavaScriptRegexEngine(),
75 }),
76 );
77 }
78 return shikiHighlighterPromise;
79}
80
81function collectPlainCodeTargets() {
82 if (typeof document === "undefined") return [];
83 const nodes = Array.from(
84 document.querySelectorAll<HTMLElement>(
85 "pre > code[class*='language-'], code[class*='language-']",
86 ),
87 );
88 return nodes.filter((code) => {
89 if (code.closest("pre.shiki")) return false;
90 const pre = code.parentElement;
91 if (pre && pre.tagName === "PRE" && pre.classList.contains("shiki")) {
92 return false;
93 }
94 return toSupportedLanguage(code.className) !== null;
95 });
96}
97
98async function repairPlainCodeBlocks() {
99 const targets = collectPlainCodeTargets();
100 if (!targets.length) return;
101
102 const highlighter = await getShikiHighlighter();
103
104 for (const code of targets) {
105 const lang = toSupportedLanguage(code.className);
106 if (!lang) continue;
107 const source = (code.textContent || "").replace(/\r\n?/g, "\n");
108 if (!source.trim()) continue;
109 const html = highlighter.codeToHtml(source, {
110 lang,
111 themes: {
112 light: "light-plus",
113 dark: "dark-plus",
114 },
115 });
116 const tpl = document.createElement("template");
117 tpl.innerHTML = html.trim();
118 const replacement = tpl.content.firstElementChild as HTMLElement | null;
119 if (!replacement) continue;
120 replacement.classList.add("vp-code");
121 const pre = code.parentElement?.tagName === "PRE" ? code.parentElement : null;
122 (pre || code).replaceWith(replacement);
123 }
124
125 applyShikiInlineColorFallback();
126}
127
128function scheduleShikiRepair() {
129 if (typeof window === "undefined") return;
130 if (shikiRepairQueued) return;
131 shikiRepairQueued = true;
132 window.requestAnimationFrame(() => {
133 shikiRepairQueued = false;
134 void repairPlainCodeBlocks();
135 });
136}
137
138function scheduleShikiRepairWithRetries() {
139 if (typeof window === "undefined") return;
140 scheduleShikiRepair();
141 window.clearTimeout(shikiRepairRetry1);
142 window.clearTimeout(shikiRepairRetry2);
143 shikiRepairRetry1 = window.setTimeout(scheduleShikiRepair, 120);
144 shikiRepairRetry2 = window.setTimeout(scheduleShikiRepair, 500);
145}
146
15function applyShikiInlineColorFallback() { 147function applyShikiInlineColorFallback() {
16 if (typeof document === "undefined") return; 148 if (typeof document === "undefined") return;
17 const isDark = document.documentElement.classList.contains("dark"); 149 const isDark = document.documentElement.classList.contains("dark");
@@ -31,13 +163,28 @@ const theme: Theme = {
31 h(DefaultTheme.Layout, null, { 163 h(DefaultTheme.Layout, null, {
32 "layout-bottom": () => [h(HomeFooter), h(CompilerModal)], 164 "layout-bottom": () => [h(HomeFooter), h(CompilerModal)],
33 }), 165 }),
166 setup() {
167 if (typeof window === "undefined") return;
168 const route = useRoute();
169 watch(
170 () => route.path,
171 async () => {
172 await nextTick();
173 scheduleShikiRepairWithRetries();
174 },
175 { immediate: true },
176 );
177 },
34 enhanceApp({ app }) { 178 enhanceApp({ app }) {
35 app.component("CompilerModal", CompilerModal); 179 app.component("CompilerModal", CompilerModal);
36 app.component("YueCompiler", YueCompiler); 180 app.component("YueCompiler", YueCompiler);
37 app.component("YueDisplay", YueDisplay); 181 app.component("YueDisplay", YueDisplay);
38 182
39 if (typeof window !== "undefined") { 183 if (typeof window !== "undefined") {
40 const run = () => requestAnimationFrame(applyShikiInlineColorFallback); 184 const run = () => {
185 requestAnimationFrame(applyShikiInlineColorFallback);
186 scheduleShikiRepairWithRetries();
187 };
41 window.addEventListener("DOMContentLoaded", run, { once: true }); 188 window.addEventListener("DOMContentLoaded", run, { once: true });
42 window.addEventListener("load", run, { once: true }); 189 window.addEventListener("load", run, { once: true });
43 190
diff --git a/doc/docs/de/doc/getting-started/usage.md b/doc/docs/de/doc/getting-started/usage.md
index 2c10406..2a1864a 100644
--- a/doc/docs/de/doc/getting-started/usage.md
+++ b/doc/docs/de/doc/getting-started/usage.md
@@ -8,7 +8,7 @@ YueScript-Modul in Lua verwenden:
8 8
9 "your_yuescript_entry.yue" in Lua require'n. 9 "your_yuescript_entry.yue" in Lua require'n.
10 10
11 ```Lua 11 ```lua
12 require("yue")("your_yuescript_entry") 12 require("yue")("your_yuescript_entry")
13 ``` 13 ```
14 14
diff --git a/doc/docs/doc/getting-started/usage.md b/doc/docs/doc/getting-started/usage.md
index 8818dd0..c02e8c0 100644
--- a/doc/docs/doc/getting-started/usage.md
+++ b/doc/docs/doc/getting-started/usage.md
@@ -8,7 +8,7 @@ Use YueScript module in Lua:
8 8
9 Require "your_yuescript_entry.yue" in Lua. 9 Require "your_yuescript_entry.yue" in Lua.
10 10
11 ```Lua 11 ```lua
12 require("yue")("your_yuescript_entry") 12 require("yue")("your_yuescript_entry")
13 ``` 13 ```
14 14
diff --git a/doc/docs/id-id/doc/getting-started/usage.md b/doc/docs/id-id/doc/getting-started/usage.md
index a9523f7..a092163 100644
--- a/doc/docs/id-id/doc/getting-started/usage.md
+++ b/doc/docs/id-id/doc/getting-started/usage.md
@@ -8,7 +8,7 @@ Gunakan modul YueScript di Lua:
8 8
9 Require "your_yuescript_entry.yue" di Lua. 9 Require "your_yuescript_entry.yue" di Lua.
10 10
11 ```Lua 11 ```lua
12 require("yue")("your_yuescript_entry") 12 require("yue")("your_yuescript_entry")
13 ``` 13 ```
14 14
diff --git a/doc/docs/pt-br/doc/getting-started/usage.md b/doc/docs/pt-br/doc/getting-started/usage.md
index 055c6c2..c3b5dfe 100644
--- a/doc/docs/pt-br/doc/getting-started/usage.md
+++ b/doc/docs/pt-br/doc/getting-started/usage.md
@@ -8,7 +8,7 @@ Use o módulo YueScript em Lua:
8 8
9 Use require em "your_yuescript_entry.yue" no Lua. 9 Use require em "your_yuescript_entry.yue" no Lua.
10 10
11 ```Lua 11 ```lua
12 require("yue")("your_yuescript_entry") 12 require("yue")("your_yuescript_entry")
13 ``` 13 ```
14 14
diff --git a/doc/docs/zh/doc/getting-started/usage.md b/doc/docs/zh/doc/getting-started/usage.md
index c9bad2e..b605e7c 100644
--- a/doc/docs/zh/doc/getting-started/usage.md
+++ b/doc/docs/zh/doc/getting-started/usage.md
@@ -8,7 +8,7 @@
8 8
9 &emsp;&emsp;在 Lua 中引入 "你的脚本入口文件.yue"。 9 &emsp;&emsp;在 Lua 中引入 "你的脚本入口文件.yue"。
10 10
11 ```Lua 11 ```lua
12 require("yue")("你的脚本入口文件") 12 require("yue")("你的脚本入口文件")
13 ``` 13 ```
14 14
diff --git a/doc/package.json b/doc/package.json
index f8fa882..45fb213 100755
--- a/doc/package.json
+++ b/doc/package.json
@@ -10,7 +10,7 @@
10 "repository": "https://github.com/pigpigyyy/Yuescript/doc", 10 "repository": "https://github.com/pigpigyyy/Yuescript/doc",
11 "scripts": { 11 "scripts": {
12 "dev": "vitepress dev docs", 12 "dev": "vitepress dev docs",
13 "build": "vitepress build docs && node scripts/fix-css-link-rel.mjs", 13 "build": "vitepress build docs",
14 "preview": "vitepress preview docs" 14 "preview": "vitepress preview docs"
15 }, 15 },
16 "license": "MIT", 16 "license": "MIT",
diff --git a/doc/scripts/fix-css-link-rel.mjs b/doc/scripts/fix-css-link-rel.mjs
deleted file mode 100644
index 4c48868..0000000
--- a/doc/scripts/fix-css-link-rel.mjs
+++ /dev/null
@@ -1,32 +0,0 @@
1import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
2import { join } from "node:path";
3
4const distRoot = "docs/.vitepress/dist";
5const preloadStylesheetRelPattern = /rel="preload stylesheet"/g;
6const stylesheetAsPattern = /(<link[^>]*rel="stylesheet"[^>]*?)\s+as="style"/g;
7
8function walk(dir, files = []) {
9 for (const entry of readdirSync(dir)) {
10 const fullPath = join(dir, entry);
11 const stat = statSync(fullPath);
12 if (stat.isDirectory()) {
13 walk(fullPath, files);
14 } else if (fullPath.endsWith(".html")) {
15 files.push(fullPath);
16 }
17 }
18 return files;
19}
20
21let updated = 0;
22for (const filePath of walk(distRoot)) {
23 const original = readFileSync(filePath, "utf8");
24 let fixed = original.replace(preloadStylesheetRelPattern, 'rel="stylesheet"');
25 fixed = fixed.replace(stylesheetAsPattern, "$1");
26 if (fixed !== original) {
27 writeFileSync(filePath, fixed, "utf8");
28 updated += 1;
29 }
30}
31
32console.log(`[fix-css-link-rel] Updated ${updated} HTML files.`);
diff --git a/doc/yue-de.md b/doc/yue-de.md
index 36d96cd..4db290b 100644
--- a/doc/yue-de.md
+++ b/doc/yue-de.md
@@ -2377,7 +2377,7 @@ YueScript-Modul in Lua verwenden:
2377 2377
2378 "your_yuescript_entry.yue" in Lua require'n. 2378 "your_yuescript_entry.yue" in Lua require'n.
2379 2379
2380 ```Lua 2380 ```lua
2381 require("yue")("your_yuescript_entry") 2381 require("yue")("your_yuescript_entry")
2382 ``` 2382 ```
2383 2383
diff --git a/doc/yue-en.md b/doc/yue-en.md
index a16060c..04ef456 100644
--- a/doc/yue-en.md
+++ b/doc/yue-en.md
@@ -2379,7 +2379,7 @@ Use YueScript module in Lua:
2379 2379
2380 Require "your_yuescript_entry.yue" in Lua. 2380 Require "your_yuescript_entry.yue" in Lua.
2381 2381
2382 ```Lua 2382 ```lua
2383 require("yue")("your_yuescript_entry") 2383 require("yue")("your_yuescript_entry")
2384 ``` 2384 ```
2385 2385
diff --git a/doc/yue-id-id.md b/doc/yue-id-id.md
index 704ebe4..63e1969 100644
--- a/doc/yue-id-id.md
+++ b/doc/yue-id-id.md
@@ -2377,7 +2377,7 @@ Gunakan modul YueScript di Lua:
2377 2377
2378 Require "your_yuescript_entry.yue" di Lua. 2378 Require "your_yuescript_entry.yue" di Lua.
2379 2379
2380 ```Lua 2380 ```lua
2381 require("yue")("your_yuescript_entry") 2381 require("yue")("your_yuescript_entry")
2382 ``` 2382 ```
2383 2383
diff --git a/doc/yue-pt-br.md b/doc/yue-pt-br.md
index fccbdf6..65e332a 100644
--- a/doc/yue-pt-br.md
+++ b/doc/yue-pt-br.md
@@ -2376,7 +2376,7 @@ Use o módulo YueScript em Lua:
2376 2376
2377 Use require em "your_yuescript_entry.yue" no Lua. 2377 Use require em "your_yuescript_entry.yue" no Lua.
2378 2378
2379 ```Lua 2379 ```lua
2380 require("yue")("your_yuescript_entry") 2380 require("yue")("your_yuescript_entry")
2381 ``` 2381 ```
2382 2382
diff --git a/doc/yue-zh.md b/doc/yue-zh.md
index 7454eab..96e19ba 100644
--- a/doc/yue-zh.md
+++ b/doc/yue-zh.md
@@ -2371,7 +2371,7 @@ print i, k -- 这些已经被更新
2371 2371
2372 &emsp;&emsp;在 Lua 中引入 "你的脚本入口文件.yue"。 2372 &emsp;&emsp;在 Lua 中引入 "你的脚本入口文件.yue"。
2373 2373
2374 ```Lua 2374 ```lua
2375 require("yue")("你的脚本入口文件") 2375 require("yue")("你的脚本入口文件")
2376 ``` 2376 ```
2377 2377