WikiChree.COM
新規
編集
添付
管理
WikiChreeガイド
WikiChreeの公式ガイドです。
最新の20件
2026-09-19
プラグイン/linkvote
2026-09-05
DokuFarm
WikiChree.COM
プラグイン/touchgraph
プラグイン/tracker_list
プラグイン/template
プラグイン/version
プラグイン/yetlist
プラグイン/unfreeze
プラグイン/source
プラグイン/versionlist
プラグイン/update_entities
2026-09-04
[テーブル番号または設定]
プラグイン/vote
プラグイン/tracker
プラグイン/topicpath
プラグイン/size
プラグイン/showrss
プラグイン/server
プラグイン/setlinebreak
開始行:
* Pkript/サンプル [#p8a0b62c]
Pkriptスクリプトのサンプル集です。
plugin/pkript/script/<名前>.js に保存するか、:config/pkri...
#contents
** hello - あいさつ [#y0e52f3f]
引数を受け取ってHTMLを出力する基本的な例です。
plugin/pkript/script/hello.js
#highlight{{
function plugin_hello_convert(e) {
var args = func_get_args();
var name = args[0] || "World";
return "<p>Hello, " + htmlsc(name) + "!</p>";
}
function plugin_hello_inline(e) {
var name = e.args[0] || "World";
return "<span>Hello, " + htmlsc(name) + "!</span>";
}
}}
使い方:
#pkript(hello, World)
&pkript(hello, World);
出力:
<p>Hello, World!</p>
<span>Hello, World!</span>
** badge - 色付きラベル [#r6b1dda0]
style属性でインラインバッジを表示します。
plugin/pkript/script/badge.js
#highlight{{
function plugin_badge_inline(e) {
var label = htmlsc(e.args[0] || "NEW");
var color = e.args[1] || "#0066cc";
var style = "display:inline-block; padding:2px 8px; b...
+ "background-color:" + color + "; color:#ffffff;...
return "<span style='" + style + "'>" + label + "</sp...
}
}}
使い方:
&badge(NEW, #cc0000);
&badge(v0.3, #0066cc);
** box - メッセージ枠 [#l9762ebb]
タイトルと本文を受け取って囲み枠を出力します。
plugin/pkript/script/box.js
#highlight{{
function plugin_box_convert(e) {
var title = htmlsc(e.args[0] || "お知らせ");
var text = htmlsc(e.args[1] || "");
return "<div style='border:1px solid #cccccc; border-...
+ "<div style='font-weight:bold; margin-bottom:4p...
+ "<div>" + text + "</div>"
+ "</div>";
}
}}
使い方:
#box(お知らせ, 明日はメンテナンスを実施します。)
** sum - 引数の合計 [#h9550a2f]
渡された数値を合算して返します。
plugin/pkript/script/sum.js
#highlight{{
function plugin_sum_inline(e) {
var total = 0;
for (const arg of e.args) {
total += Number(arg);
}
return "" + total;
}
}}
使い方:
&sum(10, 20, 30);
** pagelist - ページ一覧 [#ra1c197b]
wiki.pages と map メソッドを使って、指定プレフィックスの...
plugin/pkript/script/pagelist.js
#highlight{{
function plugin_pagelist_convert(e) {
var prefix = e.args[0] || "";
var pages = wiki.pages(prefix);
if (pages.length == 0) return "<p>該当するページがあ...
var listItems = pages.map((p) => "<li>" + wiki.link(p...
return "<ul>\n" + listItems + "\n</ul>";
}
}}
使い方:
#pagelist(Docs/)
** guestbook - 投稿フォーム [#oea68337]
フォームから入力された内容をページに追記します。
plugin/pkript/script/guestbook.js
#highlight{{
function plugin_guestbook_convert(e) {
return "<form method=\"post\">"
+ "<input type=\"hidden\" name=\"plugin\" value=\...
+ "<input type=\"hidden\" name=\"script\" value=\...
+ "<input type=\"hidden\" name=\"pkript_token\" v...
+ "<p>お名前: <input type=\"text\" name=\"name\">...
+ "<p>コメント: <textarea name=\"comment\" rows=\...
+ "<p><input type=\"submit\" value=\"投稿する\"><...
+ "</form>";
}
function plugin_guestbook_action(e) {
if (e.method != "POST") return "<p>POSTで送信してくだ...
var name = e.vars["name"] || "名無し";
var comment = e.vars["comment"] || "";
if (comment == "") return "<p>コメントを入力してくだ...
var entry = "\n- " + name + " : " + comment;
wiki.append("GuestBook", entry);
return "<p>投稿を受け付けました。<a href=\"./?GuestBo...
}
}}
使い方:
#guestbook
*** 投稿内容の扱い [#p2121264]
wiki.append で書き込んだ内容はWiki記法として解釈されます...
PukiWiki 本体の #comment も同じ作りですが、誰でも投稿でき...
// 行頭記号と改行を潰してから書き込む例
var comment = e.vars["comment"].replaceAll("\n", " ");
if (comment.startsWith("#") || comment.startsWith("*")) ...
** vote - 投票(データ保存) [#vote_sample]
data.* に集計を保存する投票です。同梱の plugin/pkript/scr...
使い方:
#vote(好きな色){{
赤
青
緑
}}
要点だけを抜き出すと次のようになります。
#highlight{{
const keyFor = (page, title) => "vote/" + slug(page) + "/...
function plugin_vote_convert(e) {
const tally = data.get(keyFor(e.page, title), {counts...
// ...集計を表に描き、投票フォームを出す
}
function plugin_vote_action(e) {
const key = keyFor(e.vars["page"], e.vars["title"]);
const tally = data.get(key, {counts: {}, voters: []});
tally.counts[choice] = countOf(tally, choice) + 1;
if (e.user.name != "") tally.voters.push(e.user.name);
data.set(key, tally);
}
}}
- 集計は :config/pkript/data/vote/<ページ>/<質問> に入り...
- ログインしていれば、投票した人の名前を控えて二重投票を...
- フォームを出すかどうかは data.canWrite() で決めます。
** vote2 - 投票(ページ内保存) [#vote2_sample]
PukiWiki本体の vote.inc.php と同じで、集計を呼び出し行そ...
使い方:
#vote2(赤[1],あお[0],green)
投票すると、ページのその行が書き換わります。
#vote2(赤[1],あお[1],green[0])
#highlight{{
function plugin_vote2_action(e) {
const source = wiki.source(page);
const line = findCall(source, sent); // 自分...
const current = parseChoices(argsOf(line)); // ペー...
current[index].count = current[index].count + 1;
wiki.write(page, source.replace(line, "#vote2(" + for...
wiki.redirect(page);
}
}}
- 集計がページの中にあるので、差分・バックアップ・凍結が...
- そのかわり投票する人にページの編集権限が必要です。書け...
- 送信されてきた数ではなく、書き込む直前にページから読み...
- 書き込みのあと wiki.redirect() でページに戻します。これ...
*** どちらを使うか [#m4d184ef]
|~|~vote(data.*)|~vote2(ページ内)|h
|投票に必要な権限|不要|ページの編集権限|
|集計の置き場所|:config/pkript/data/*|呼び出し行の中|
|差分・バックアップ|データページ側に付く|本文と一緒に付く|
|二重投票の抑止|ログイン中なら可能|しない(本体と同じ)|
** jsxcard - JSX記法のカード [#b99f0cab]
JSX記法で枠付きのカードを出します。文字列連結を使わずにHT...
plugin/pkript/script/jsxcard.js
#highlight{{{
// Pkript sample: #pkript(jsxcard, 見出し, class=note){{
// 本文
// }}
const COLORS = { note: "#4a6", warn: "#c62", info: "#468"...
function pickColor(kind) {
return Object.has(COLORS, kind) ? COLORS[kind] : COLO...
}
function plugin_jsxcard_convert(e) {
const title = e.args[0] || "(無題)";
const kind = e.opts["class"] || "info";
const color = pickColor(kind);
const lines = e.body == "" ? [] : e.body.split("\n");
return <div class={"card " + kind} style={"border-lef...
<p style={"color: " + color}><b>{title}</b></p>
{lines.map((line) => <p>{line}</p>).join("")}
</div>;
}
}}}
使い方:
#jsxcard(お知らせ, class=warn){{
本文の1行目
本文の2行目
}}
出力:
<div class="pkript-card pkript-warn" style="border-left:...
<p style="color:#c62"><b>お知らせ</b></p>
<p>本文の1行目</p><p>本文の2行目</p>
</div>
本文に <b> のようなタグを書いても、{} の中の文字列...
詳しくは [[Pkript/文法/JSX]] を参照してください。
** highlight - 文法ハイライト [#j76eed93]
Pkriptのコードに対して色付けをします。
plugin/pkript/script/highlight.js
#highlight{{{
// Pkript: Syntax Highlighter
// Usage:
// #highlight{{
// function hello(name) {
// console.log("Hello, " + name);
// }
// }}
function isAlpha(c) {
return (c >= "a" && c <= "z") || (c >= "A" && c <= "Z...
}
function isDigit(c) {
return c >= "0" && c <= "9";
}
function isAlphaNum(c) {
return isAlpha(c) || isDigit(c);
}
const KEYWORDS = [
"function", "return", "let", "const", "var", "if", "e...
"for", "of", "in", "break", "continue", "switch", "ca...
"new", "typeof", "instanceof", "try", "catch", "final...
"class", "extends", "import", "export", "from", "as",...
"yield", "this", "super", "delete", "void"
];
const BUILTINS = [
"true", "false", "null", "undefined", "NaN", "Infinit...
"String", "Number", "Boolean", "Array", "Object", "Ma...
"console", "document", "window", "Promise", "Symbol",...
];
// Character sets for the scanner. spanWhile/spanUntil ta...
// call; a character at a time costs 50-60 steps each.
const IDENT_CHARS = "a-zA-Z0-9_$";
const NUM_CHARS = "0-9.";
const SPACE_CHARS = " \t";
// Anything that can start a token of its own
const TOKEN_START = "/\"'`0-9a-zA-Z_$";
function highlightJs(code) {
let out = "";
let i = 0;
const len = code.length;
while (i < len) {
const c = code.charAt(i);
const c2 = i + 1 < len ? code.charAt(i + 1) : "";
// Single-line comment: // ...
if (c == "/" && c2 == "/") {
const start = i;
i = code.spanUntil(i, "\n");
const comment = code.substring(start, i);
out += "<span style=\"color: #308a27; font-st...
continue;
}
// Multi-line comment: /* ... */
if (c == "/" && c2 == "*") {
const start = i;
const end = code.indexOf("*/", i + 2);
i = end < 0 ? len : end + 2;
const comment = code.substring(start, i);
out += "<span style=\"color: #308a27; font-st...
continue;
}
// String literals: "...", '...', `...`
if (c == "\"" || c == "'" || c == "`") {
const quote = c;
// A backtick string may span lines; the othe...
const stop = quote == "`" ? "\\" + quote : "\...
const start = i;
i++;
while (i < len) {
i = code.spanUntil(i, stop);
if (i >= len) {
break;
}
const sc = code.charAt(i);
if (sc == "\\") {
i += 2;
continue;
}
if (sc == quote) {
i++;
break;
}
break; // newline in a non-backtick ...
}
const strVal = code.substring(start, i);
out += "<span style=\"color: #032f62;\">" + h...
continue;
}
// Number literals
if (isDigit(c)) {
const start = i;
i = code.spanWhile(i, NUM_CHARS);
const numVal = code.substring(start, i);
out += "<span style=\"color: #005cc5;\">" + h...
continue;
}
// Identifiers, Keywords, Builtins
if (isAlpha(c)) {
const start = i;
i = code.spanWhile(i, IDENT_CHARS);
const ident = code.substring(start, i);
// Look ahead for function call: func(...)
const lookAhead = code.spanWhile(i, SPACE_CHA...
const isCall = lookAhead < len && code.charAt...
if (KEYWORDS.includes(ident)) {
out += "<span style=\"color: #d73a49; fon...
} else if (BUILTINS.includes(ident)) {
out += "<span style=\"color: #6f42c1;\">"...
} else if (isCall) {
out += "<span style=\"color: #005cc5;\">"...
} else {
out += htmlsc(ident);
}
continue;
}
// Punctuation and whitespace, taken as a run rat...
const plain = code.spanUntil(i + 1, TOKEN_START);
out += htmlsc(code.substring(i, plain));
i = plain;
}
return out;
}
function getCode(e) {
if (e.body != "") return e.body;
if (e.args.length > 0 && e.args[0] != "") return e.ar...
return "";
}
function plugin_highlight_convert(e) {
const code = getCode(e);
if (code == "") return "<p>(no code)</p>";
const highlighted = highlightJs(code);
return "<pre style=\"background-color: #f6f8fa; color...
}
}}}
使い方:
#highlight{{
function hello(name) {
console.log("Hello, " + name);
}
}}
** recent - 更新時刻付きページ一覧 [#recent_sample]
ページの最終更新時刻と凍結状態を一覧表示します。wiki.time...
plugin/pkript/script/recent.js
#highlight{{
function plugin_recent_convert(e) {
const prefix = e.args[0] || "";
const pages = wiki.pages(prefix);
if (pages.length == 0) return "<p>該当するページがあ...
// 各ページの更新時刻と凍結状態を取得
const items = pages.map((page) => {
const t = wiki.time(page);
return {
page: page,
time: t,
frozen: wiki.isFrozen(page)
};
});
// 更新時刻の新しい順にソート
items.sort((a, b) => b.time - a.time);
const rows = items.map((item, idx) => {
const no = String(idx + 1).padStart(2, "0");
const frozenMark = item.frozen ? " <i>(凍結)</i>"...
const timeStr = date.format(item.time);
return "<li>" + no + ". " + wiki.link(item.page) ...
}).join("\n");
return "<ul>\n" + rows + "\n</ul>";
}
}}
使い方:
#recent(Docs/)
終了行:
* Pkript/サンプル [#p8a0b62c]
Pkriptスクリプトのサンプル集です。
plugin/pkript/script/<名前>.js に保存するか、:config/pkri...
#contents
** hello - あいさつ [#y0e52f3f]
引数を受け取ってHTMLを出力する基本的な例です。
plugin/pkript/script/hello.js
#highlight{{
function plugin_hello_convert(e) {
var args = func_get_args();
var name = args[0] || "World";
return "<p>Hello, " + htmlsc(name) + "!</p>";
}
function plugin_hello_inline(e) {
var name = e.args[0] || "World";
return "<span>Hello, " + htmlsc(name) + "!</span>";
}
}}
使い方:
#pkript(hello, World)
&pkript(hello, World);
出力:
<p>Hello, World!</p>
<span>Hello, World!</span>
** badge - 色付きラベル [#r6b1dda0]
style属性でインラインバッジを表示します。
plugin/pkript/script/badge.js
#highlight{{
function plugin_badge_inline(e) {
var label = htmlsc(e.args[0] || "NEW");
var color = e.args[1] || "#0066cc";
var style = "display:inline-block; padding:2px 8px; b...
+ "background-color:" + color + "; color:#ffffff;...
return "<span style='" + style + "'>" + label + "</sp...
}
}}
使い方:
&badge(NEW, #cc0000);
&badge(v0.3, #0066cc);
** box - メッセージ枠 [#l9762ebb]
タイトルと本文を受け取って囲み枠を出力します。
plugin/pkript/script/box.js
#highlight{{
function plugin_box_convert(e) {
var title = htmlsc(e.args[0] || "お知らせ");
var text = htmlsc(e.args[1] || "");
return "<div style='border:1px solid #cccccc; border-...
+ "<div style='font-weight:bold; margin-bottom:4p...
+ "<div>" + text + "</div>"
+ "</div>";
}
}}
使い方:
#box(お知らせ, 明日はメンテナンスを実施します。)
** sum - 引数の合計 [#h9550a2f]
渡された数値を合算して返します。
plugin/pkript/script/sum.js
#highlight{{
function plugin_sum_inline(e) {
var total = 0;
for (const arg of e.args) {
total += Number(arg);
}
return "" + total;
}
}}
使い方:
&sum(10, 20, 30);
** pagelist - ページ一覧 [#ra1c197b]
wiki.pages と map メソッドを使って、指定プレフィックスの...
plugin/pkript/script/pagelist.js
#highlight{{
function plugin_pagelist_convert(e) {
var prefix = e.args[0] || "";
var pages = wiki.pages(prefix);
if (pages.length == 0) return "<p>該当するページがあ...
var listItems = pages.map((p) => "<li>" + wiki.link(p...
return "<ul>\n" + listItems + "\n</ul>";
}
}}
使い方:
#pagelist(Docs/)
** guestbook - 投稿フォーム [#oea68337]
フォームから入力された内容をページに追記します。
plugin/pkript/script/guestbook.js
#highlight{{
function plugin_guestbook_convert(e) {
return "<form method=\"post\">"
+ "<input type=\"hidden\" name=\"plugin\" value=\...
+ "<input type=\"hidden\" name=\"script\" value=\...
+ "<input type=\"hidden\" name=\"pkript_token\" v...
+ "<p>お名前: <input type=\"text\" name=\"name\">...
+ "<p>コメント: <textarea name=\"comment\" rows=\...
+ "<p><input type=\"submit\" value=\"投稿する\"><...
+ "</form>";
}
function plugin_guestbook_action(e) {
if (e.method != "POST") return "<p>POSTで送信してくだ...
var name = e.vars["name"] || "名無し";
var comment = e.vars["comment"] || "";
if (comment == "") return "<p>コメントを入力してくだ...
var entry = "\n- " + name + " : " + comment;
wiki.append("GuestBook", entry);
return "<p>投稿を受け付けました。<a href=\"./?GuestBo...
}
}}
使い方:
#guestbook
*** 投稿内容の扱い [#p2121264]
wiki.append で書き込んだ内容はWiki記法として解釈されます...
PukiWiki 本体の #comment も同じ作りですが、誰でも投稿でき...
// 行頭記号と改行を潰してから書き込む例
var comment = e.vars["comment"].replaceAll("\n", " ");
if (comment.startsWith("#") || comment.startsWith("*")) ...
** vote - 投票(データ保存) [#vote_sample]
data.* に集計を保存する投票です。同梱の plugin/pkript/scr...
使い方:
#vote(好きな色){{
赤
青
緑
}}
要点だけを抜き出すと次のようになります。
#highlight{{
const keyFor = (page, title) => "vote/" + slug(page) + "/...
function plugin_vote_convert(e) {
const tally = data.get(keyFor(e.page, title), {counts...
// ...集計を表に描き、投票フォームを出す
}
function plugin_vote_action(e) {
const key = keyFor(e.vars["page"], e.vars["title"]);
const tally = data.get(key, {counts: {}, voters: []});
tally.counts[choice] = countOf(tally, choice) + 1;
if (e.user.name != "") tally.voters.push(e.user.name);
data.set(key, tally);
}
}}
- 集計は :config/pkript/data/vote/<ページ>/<質問> に入り...
- ログインしていれば、投票した人の名前を控えて二重投票を...
- フォームを出すかどうかは data.canWrite() で決めます。
** vote2 - 投票(ページ内保存) [#vote2_sample]
PukiWiki本体の vote.inc.php と同じで、集計を呼び出し行そ...
使い方:
#vote2(赤[1],あお[0],green)
投票すると、ページのその行が書き換わります。
#vote2(赤[1],あお[1],green[0])
#highlight{{
function plugin_vote2_action(e) {
const source = wiki.source(page);
const line = findCall(source, sent); // 自分...
const current = parseChoices(argsOf(line)); // ペー...
current[index].count = current[index].count + 1;
wiki.write(page, source.replace(line, "#vote2(" + for...
wiki.redirect(page);
}
}}
- 集計がページの中にあるので、差分・バックアップ・凍結が...
- そのかわり投票する人にページの編集権限が必要です。書け...
- 送信されてきた数ではなく、書き込む直前にページから読み...
- 書き込みのあと wiki.redirect() でページに戻します。これ...
*** どちらを使うか [#m4d184ef]
|~|~vote(data.*)|~vote2(ページ内)|h
|投票に必要な権限|不要|ページの編集権限|
|集計の置き場所|:config/pkript/data/*|呼び出し行の中|
|差分・バックアップ|データページ側に付く|本文と一緒に付く|
|二重投票の抑止|ログイン中なら可能|しない(本体と同じ)|
** jsxcard - JSX記法のカード [#b99f0cab]
JSX記法で枠付きのカードを出します。文字列連結を使わずにHT...
plugin/pkript/script/jsxcard.js
#highlight{{{
// Pkript sample: #pkript(jsxcard, 見出し, class=note){{
// 本文
// }}
const COLORS = { note: "#4a6", warn: "#c62", info: "#468"...
function pickColor(kind) {
return Object.has(COLORS, kind) ? COLORS[kind] : COLO...
}
function plugin_jsxcard_convert(e) {
const title = e.args[0] || "(無題)";
const kind = e.opts["class"] || "info";
const color = pickColor(kind);
const lines = e.body == "" ? [] : e.body.split("\n");
return <div class={"card " + kind} style={"border-lef...
<p style={"color: " + color}><b>{title}</b></p>
{lines.map((line) => <p>{line}</p>).join("")}
</div>;
}
}}}
使い方:
#jsxcard(お知らせ, class=warn){{
本文の1行目
本文の2行目
}}
出力:
<div class="pkript-card pkript-warn" style="border-left:...
<p style="color:#c62"><b>お知らせ</b></p>
<p>本文の1行目</p><p>本文の2行目</p>
</div>
本文に <b> のようなタグを書いても、{} の中の文字列...
詳しくは [[Pkript/文法/JSX]] を参照してください。
** highlight - 文法ハイライト [#j76eed93]
Pkriptのコードに対して色付けをします。
plugin/pkript/script/highlight.js
#highlight{{{
// Pkript: Syntax Highlighter
// Usage:
// #highlight{{
// function hello(name) {
// console.log("Hello, " + name);
// }
// }}
function isAlpha(c) {
return (c >= "a" && c <= "z") || (c >= "A" && c <= "Z...
}
function isDigit(c) {
return c >= "0" && c <= "9";
}
function isAlphaNum(c) {
return isAlpha(c) || isDigit(c);
}
const KEYWORDS = [
"function", "return", "let", "const", "var", "if", "e...
"for", "of", "in", "break", "continue", "switch", "ca...
"new", "typeof", "instanceof", "try", "catch", "final...
"class", "extends", "import", "export", "from", "as",...
"yield", "this", "super", "delete", "void"
];
const BUILTINS = [
"true", "false", "null", "undefined", "NaN", "Infinit...
"String", "Number", "Boolean", "Array", "Object", "Ma...
"console", "document", "window", "Promise", "Symbol",...
];
// Character sets for the scanner. spanWhile/spanUntil ta...
// call; a character at a time costs 50-60 steps each.
const IDENT_CHARS = "a-zA-Z0-9_$";
const NUM_CHARS = "0-9.";
const SPACE_CHARS = " \t";
// Anything that can start a token of its own
const TOKEN_START = "/\"'`0-9a-zA-Z_$";
function highlightJs(code) {
let out = "";
let i = 0;
const len = code.length;
while (i < len) {
const c = code.charAt(i);
const c2 = i + 1 < len ? code.charAt(i + 1) : "";
// Single-line comment: // ...
if (c == "/" && c2 == "/") {
const start = i;
i = code.spanUntil(i, "\n");
const comment = code.substring(start, i);
out += "<span style=\"color: #308a27; font-st...
continue;
}
// Multi-line comment: /* ... */
if (c == "/" && c2 == "*") {
const start = i;
const end = code.indexOf("*/", i + 2);
i = end < 0 ? len : end + 2;
const comment = code.substring(start, i);
out += "<span style=\"color: #308a27; font-st...
continue;
}
// String literals: "...", '...', `...`
if (c == "\"" || c == "'" || c == "`") {
const quote = c;
// A backtick string may span lines; the othe...
const stop = quote == "`" ? "\\" + quote : "\...
const start = i;
i++;
while (i < len) {
i = code.spanUntil(i, stop);
if (i >= len) {
break;
}
const sc = code.charAt(i);
if (sc == "\\") {
i += 2;
continue;
}
if (sc == quote) {
i++;
break;
}
break; // newline in a non-backtick ...
}
const strVal = code.substring(start, i);
out += "<span style=\"color: #032f62;\">" + h...
continue;
}
// Number literals
if (isDigit(c)) {
const start = i;
i = code.spanWhile(i, NUM_CHARS);
const numVal = code.substring(start, i);
out += "<span style=\"color: #005cc5;\">" + h...
continue;
}
// Identifiers, Keywords, Builtins
if (isAlpha(c)) {
const start = i;
i = code.spanWhile(i, IDENT_CHARS);
const ident = code.substring(start, i);
// Look ahead for function call: func(...)
const lookAhead = code.spanWhile(i, SPACE_CHA...
const isCall = lookAhead < len && code.charAt...
if (KEYWORDS.includes(ident)) {
out += "<span style=\"color: #d73a49; fon...
} else if (BUILTINS.includes(ident)) {
out += "<span style=\"color: #6f42c1;\">"...
} else if (isCall) {
out += "<span style=\"color: #005cc5;\">"...
} else {
out += htmlsc(ident);
}
continue;
}
// Punctuation and whitespace, taken as a run rat...
const plain = code.spanUntil(i + 1, TOKEN_START);
out += htmlsc(code.substring(i, plain));
i = plain;
}
return out;
}
function getCode(e) {
if (e.body != "") return e.body;
if (e.args.length > 0 && e.args[0] != "") return e.ar...
return "";
}
function plugin_highlight_convert(e) {
const code = getCode(e);
if (code == "") return "<p>(no code)</p>";
const highlighted = highlightJs(code);
return "<pre style=\"background-color: #f6f8fa; color...
}
}}}
使い方:
#highlight{{
function hello(name) {
console.log("Hello, " + name);
}
}}
** recent - 更新時刻付きページ一覧 [#recent_sample]
ページの最終更新時刻と凍結状態を一覧表示します。wiki.time...
plugin/pkript/script/recent.js
#highlight{{
function plugin_recent_convert(e) {
const prefix = e.args[0] || "";
const pages = wiki.pages(prefix);
if (pages.length == 0) return "<p>該当するページがあ...
// 各ページの更新時刻と凍結状態を取得
const items = pages.map((page) => {
const t = wiki.time(page);
return {
page: page,
time: t,
frozen: wiki.isFrozen(page)
};
});
// 更新時刻の新しい順にソート
items.sort((a, b) => b.time - a.time);
const rows = items.map((item, idx) => {
const no = String(idx + 1).padStart(2, "0");
const frozenMark = item.frozen ? " <i>(凍結)</i>"...
const timeStr = date.format(item.time);
return "<li>" + no + ". " + wiki.link(item.page) ...
}).join("\n");
return "<ul>\n" + rows + "\n</ul>";
}
}}
使い方:
#recent(Docs/)
ページ名:
既存のページ名で編集する