wiki.js
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
[[LinuxServer]]
#contents();
* なぜ pukiwiki から wiki.js へ移行しようと思ったか 1 [#w...
+ コメントの受け付けしたい
+ スパムがやだ
+ 過去にストーカー被害にあったこともあり、特定のユーザー...
+ ユーザーが、ユーザー自身を登録できる wiki が良いなぁ。...
** なぜ pukiwiki から wiki.js へ移行しようと思ったか 2 [#...
- 自分、 markdown 言語が大好きだから。
- 正直、書いてると落ち着きます。。。
* 公式リンク(top) [#x2afee6a]
-[Wiki.js](https://docs.requarks.io/)
** Editor - Markdown [#uaa8ce5b]
-[Editors - Markdown](https://docs.requarks.io/editors/ma...
** Editor - MarkDown(日本語) [#ib839f7d]
-[(designet)8. エディターの使用方法](https://www.designet...
* 前提 [#o12d77ef]
** 環境 [#ibd58668]
- proxmoxのコンテナを使います。
- proxmox については[こちら(当方 pukiwiki )](https://tar3...
** 他に検討したもの [#ycc2e6ce]
- Growi -> mongodbにおいて CPUは avx に対応したものが必要...
うちのサーバのCPUでは対応してませんでした。。。(2009年製...
まぁしようがないですね(^^;)
- wikiを比較する際は、以下のサイトを参考にしました。~
-- [(designet) 社内Wikiのおすすめツールとは?無料で使える...
* 構築 [#b2a4ac2f]
** 構築コマンド [#b4113ec3]
- [(参考サイト) wiki.js(lxc) Proxmox VE Helper-Scripts](h...
- どれかのホストで以下のコマンドを実行
- インストール時、色々聞かれるようにカスタムインストール...
sudo su -
bash -c "$(curl -fsSL https://raw.githubusercontent.com/...
** MariaDBへ切り替え [#ja687771]
*** なぜ? [#f96f037a]
- 以下に「メディア資産管理」の項目を書くのですが、作った...
データベースを直にいじるので、使い慣れている MariaDB(MySQ...
*** 参考サイト [#hb3a54c6]
- [[参考サイト(Nginx : Wiki.js インストール):https://www....
*** MariaDB のインストールと自動起動設定,起動 [#n201138a]
sudo apt install mariadb-server
sudo apt start mariadb
sudo apt enable mariadb
*** 初期設定 [#a249db48]
sudo mysql_secure_installation
- 概要
+ Unix_Socket 認証に切り替えるか否か~
[no] でも root のみ デフォルトで Unix_Socket 認証は有効~
Switch to unix_socket authentication [Y/n] n
+ MariaDB root パスワードを設定するか否か
MariaDBへ root パスワードでもログインできるようになる。~
不要と言えば不要なんだけど、自分はバックアップの設定もあ...
Change the root password? [Y/n] y~
+ 匿名ユーザーは削除する~
Remove anonymous users? [Y/n] y
+ root のリモートログインは無効とする~
Disallow root login remotely? [Y/n] y
+ テストデータベースは削除する~
Remove test database and access to it? [Y/n] y
+ 特権情報をリロードする~
Reload privilege tables now? [Y/n] y
+ インストール完了
*** (MariaDB) wiki.js用ユーザーの作成とデータベースの作成...
+ root ユーザーでログイン
mysql
+ データベースの作成
create database wikijs;
+ 権限の設定とパスワードの設定
grant all privileges on wikijs.* to wikijs@'localhost' i...
+権限の更新
flush privileges;
+ MariaDBから出る。
exit
*** wiki.js の変更 [#r234b69b]
- できるだけ元の設定は残しておいた方が良いかもです。~
行頭に「#」を付けるとコメント・アウトになります。
sudo vi /opt/wikijs/config.yml
db:
type: mariadb
# PostgreSQL / MySQL / MariaDB / MS SQL Server only:
host: localhost
port: 3306
user: wikijs
pass: password
db: wikijs
ssl: false
*** backup [#h66719fb]
[[こちらを参照(mysql):/310-Linux/313-LinuxServer/mysql#my...
* 設定変更 [#yccb94ab]
** config.yml の場所,Path [#a7cdf876]
- ``/opt/wikijs/config.yml``~
- システム情報で確認できます。~
-- 化 [#zbdb2519]
+ key と crt は適当なディレクトリへ保存~
(自分はLet's Encryptは使ってません。有償の証明書を持って...
- 中間証明書は要らないのかな?この辺、良くわかってないで...
- ssl の port は 3443 にしています。
sudo vi /opt/wikijs/config.yml
# ------------------------------------------------------...
# SSL/TLS Settings
# ------------------------------------------------------...
# Consider using a reverse proxy (e.g. nginx) if you req...
# advanced options than those provided below.
ssl:
#enabled: false
enabled: true
port: 3443
# Provider to use, possible values: custom, letsencrypt
provider: custom
#provider: letsencrypt
# ++++++ For custom only ++++++
# Certificate format, either 'pem' or 'pfx':
format: pem
# Using PEM format:
# key
key: /etc/pki/tls/certs/server.key
# 証明書
cert: /etc/pki/tls/certs/server.crt
# Using PFX format:
#pfx: path/to/cert.pfx
# Passphrase when using encrypted PEM / PFX keys (defaul...
passphrase: null
# Diffie Hellman parameters, with key length being great...
# to 1024 bits (default: null):
dhparam: null
# ++++++ For letsencrypt only ++++++
domain: wikijp.tar3.net
subscriberEmail: hogehoge@unyaunya.net
** dataPAth: の変更 [#u6671d64]
- なんか容量食うと嫌なので普通にファイルサーバのPathを指...
dataPath: /mnt/hogehoge/data/unya/wikijs
- config.yml の変更は以上です。大したことないですね(^^)
** faviconの変更 [#t9c20831]
+ favicon.ico
-- path
--- /opt/wikijs/assets/favicon.ico
-- 画像解像度
--- 48 x 48
+ favicons ディレクトリ
-- path
--- /opt/wikijs/assets/favicons/
|ファイル名|解像度|h
|android-chrome-192x192.png|192 x 192|
|android-chrome-256x256.png|256 x 256|
|apple-touch-icon.png|180 x 180|
|favicon-16x16.png|16 x 16|
|favicon-32x32.png|32 x 32|
|mstile-150x150.png|150 x 150|
{.dense}
** Web画面からの設定変更 [#j17d18f5]
*** 全般設定 [#vd21e5e9]
- サイトのURL
- サイトのタイトル
- ロゴURL
*** 言語 [#u0b795b1]
- 日本語
*** ナビゲーション [#lf137ea2]
- サイトツリー
*** グループ [#ubd17f40]
- registerdUsers を追加。どなたかが新規にアカウントを作っ...
*** アナリティクス [#vf8039e5]
- google analytics を設定
-- Tracking ID の確認方法
-- Google Analytics -> 左側「データの収集と修正」 -> 「デ...
--- 対象のアカウントをクリック
--- 「測定ID」が Tracking ID です。
*** セキュリティ [#x465f8f5]
- アップロード
-- 最大アップロードサイズ
104857600
-- 1回あたりの最大ファイル数
50
* 記事の作成関連 [#ocf60189]
** markdown [#wac1c10f]
*** User's manual(公式) [#u26a34fb]
- [wiki.js - Markdown](https://docs.requarks.io/editors/m...
++ [image](https://docs.requarks.io/editors/markdown#imag...




++ [Keyboard Keys](https://docs.requarks.io/editors/markd...
Lorem ipsum dolor <kbd>CTRL</kbd> + <kbd>C</kbd>
++ [Links](https://docs.requarks.io/editors/markdown*links)
[Lorem ipsum](https://wiki.js.org/about)
--- ページ内の見出しへリンクする
---- Link先の取得(見出しをマウスオーバーすると右側にリン...
ここを右クリックしてリンクをコピーするとハッシュタグが取...
----- ](/310-Linux/313-LinuxServer/mysql#m...
++ [table](https://docs.requarks.io/editors/markdown#table)
| Header 1 | Header 2 | Header 3 |
|--------- |--------- | -------- |
| Foo | Bar | Xyz |
| Abc | Def | 123 |
{.dense}
++ 色
--- [参考サイト(Change text color on pages)](https://feed...
<span style='color:green;'>緑色の文字</span>
*** 書式の設定方法(参考サイト) [#f3ec7cd7]
- [[参考サイト1: Wiki hina.dev:https://wiki.o.hina.dev/wi...
-- 太字
-- イタリック
-- 取り消し線
-- 見出し
-- 下付き文字
-- 上付き文字
-- ブロック引用
-- 順序つきリスト
-- 順序無しリスト
-- タスクリスト
-- インラインコード
-- コードブロック
-- 水平線
-- 画像
-- リンク
-- キーボードキー
*** designet(参考サイト) [#acbf30cd]
- [[(designet) 8. エディターの使用方法:https://www.design...
**** ブロッククォート(箇条書きと組み合わせない場合、使用...
> スタイルなし eee
> .is-info aaa
{.is-info}
> .is-succsess bbb
{.is-success}
> .is-warning ccc
{.is-warning}
> .is-danger ddd
{.is-danger}
> スタイルなし eee
> .is-info aaa
{.is-info}
> .is-succsess bbb
{.is-success}
> .is-warning ccc
{.is-warning}
> .is-danger ddd
{.is-danger}
**** 脚注 [#u66a07c1]
This sentence[^1] needs a few footnotes.[^2]
[^1]: A string of syntactic words.
[^2]: A useful example sentence.
This sentence[^1] needs a few footnotes.[^2]
[^1]: A string of syntactic words.
[^2]: A useful example sentence.
**** キーボード,<kbd></kbd> [#o5ebdca1]
<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>o</kbd>
**** tabset [#z6fe40d1]
### タブ {.tabset}
#### タブ aaa
タブの記事
#### タブ bbb
タブの記事2
### タブ {.tabset}
#### タブ aaa
タブの記事
#### タブ bbb
タブの記事2
* メディア資産(画像など)の管理 [#j7f529ec]
- 以下のような感じの所ですね。
](/310-Linux/313-LinuxS...
{.is-warning}
** 前提条件 [#z1d15d01]
- データベースはMariaDBです。
- /opt/wikijs/config.yml の dataPath
/mnt/hoge/munya/wikijs
** 関連情報は3つ [#wd8e6fbb]
+ データベース(MariaDB)
++ assets
++ assetFolders
+ dataPath
++ /mnt/hoge/munya/wikijs/imagedirectorya/imagedirectoryb...
** table の desc 情報 [#v7af81ea]
+ assets
| Field | Type | Null | Key | Defau...
|-----------|------------------------|------|-----|------...
| id | int(10) unsigned | NO | PRI | NULL ...
| filename | varchar(255) | NO | | NULL ...
| hash | varchar(255) | NO | | NULL ...
| ext | varchar(255) | NO | | NULL ...
| kind | enum('binary','image') | NO | | binar...
| mime | varchar(255) | NO | | appli...
| fileSize | int(10) unsigned | YES | | NULL ...
| metadata | longtext | YES | | NULL ...
| createdAt | varchar(255) | NO | | NULL ...
| updatedAt | varchar(255) | NO | | NULL ...
| folderId | int(10) unsigned | YES | MUL | NULL ...
| authorId | int(10) unsigned | YES | MUL | NULL ...
{.dense}
+ assetFolders
| Field | Type | Null | Key | Default | Ex...
|----------|------------------|------|-----|---------|---...
| id | int(10) unsigned | NO | PRI | NULL | au...
| name | varchar(255) | NO | | NULL | ...
| slug | varchar(255) | NO | | NULL | ...
| parentId | int(10) unsigned | YES | MUL | NULL | ...
{.dense}
** 概要 [#p46d137a]
+ assets が画像情報の格納先です。
-- folderID で assetFolders へ正規化されています。~
ここで紐づけられたフォルダに画像が入っている必要がありま...
+ assetFolders は、親フォルダ名を持ってるだけで一般的な基...
-- フォルダ名はここで決まります。
** 場面ごとの変更方法(MariaDBでの変更方法) [#j62758ad]
- さて、実際どのように情報を変えていくかを記載していきま...
- wikiの画像参照リンクの変更も必要です。
*** 共通 [#sf214f8d]
- MariaDBへのログインとデータベースの変更~
(wikijsのMariaDBのあるサーバで実行)
sudo mysql
use wikijs
- assets と assetFolders のデータを確認
SELECT * FROM assets;
SELECT * FROM assetFolders;
*** メディア資産で表示されるフォルダ名の変更 [#p0a4ef74]
- id は上記の「SELECT * FROM assetFolders;」で表示された...
> WHERE 句を入れないと全部のフォルダー名が一律に変わって...
このミスは慣れた頃に起きるのと、結構データベースに精通し...
データベースのバックアップは重要です。
{.is-warning}
UPDATE assetFolders SET name='imagedirectoryc', slug='im...
*** メディア資産で表示されるフォルダ名の削除 [#w86ec377]
- 消す前に以下はやりましょう~。(要は以下の「[メディア資...
++ データベース情報の変更
++ サーバの物理Pathから別のフォルダへ画像を移動(mv コマン...
++ フォルダ内にある画像のリンク元の変更(``
DELETE FROM assetFolders WHERE id=2;
*** メディア資産で表示される画像ファイルのフォルダ移動 [#...
+ 正直、これは画像を再アップロードした方が早いかもしんないw
+ WHERE の後ろのIDは、対象の画像ファイルのid~
folderIdは上記「SELECT * FROM assetFolders;」の結果から変...
update assets SET folderId=35 WHERE id>=24 and id<=36;
+ Linuxサーバ上のファイルを移動
-- 例) imagedirectory<span style='color:red;'>**b**</span...
mv /mnt/hoge/munya/wikijs/imagedirectorya/imagedirectory...
+ イメージリンクを変更
-- 前(例) imagedirectory<span style='color:red;'>**b**</s...

を使用 [#kee28da4]
** おすすめ拡張機能 [#te88fa5d]
+ Markdown Preview Enhanced
+ Markdown All in One
*** 使い方(Markdown Preview Enhanced) [#afe5edc3]
- <kbd>Ctrl</kbd> + <kbd>k</kbd> <kbd>v</kbd>
- [Manual(markdown-preview-enhanced)](https://shd101wyy.g...
*** 使い方(Markdown All in One) [#z3c2d8a3]
- 特に特別な事は無いんですが、<kbd>Shift</kbd> + <kbd>Ent...
- 変更前
-- <kbd>Shift</kbd> + <kbd>Enter</kbd>で改行できない時が...
- 変更後
-- 基本的に<kbd>Shift</kbd> + <kbd>Enter</kbd>で改行でき...
- 変更方法
-- 「ファイル」 -> 「ユーザー設定」->「キーボードショート...
-- 「markdown.extension.onShiftEnterKey」で検索
-- 右クリック「When 式を変更」
-- 以下としました
editorTextFocus && !editorHasMultipleSelections && !edit...
-- 残したのは以下
--- エディターにフォーカス
--- 複数選択してない
--- エディターは読み取り専用ではない
--- エディターの言語は markdown である
--- マルチプルセレクションではない(すみません、これ良く分...
--- markdown拡張機能のエディターカーソルがCodeBlockでない...
(なのですが、CodeBlock内でも<kbd>Shift</kbd> + <kbd>Enter...
--- カーソルが MathEnv でないとき
--- あとは等々
** vscode 共通機能の設定についてはこちら [#j819535d]
- [vscode:設定](/510-program/vscode/vscode#%E8%A8%AD%E5%A...
** (vscode) 目次の作成方法 [#c7a45e33]
- wiki.jsは左側のサマリが見出し2までしか表示できないです。
個人的にはこれがかなりネックだったのですが、目次を作る事...
+ 目次を作成したい個所にカーソルを移動
+ vscode上で<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>p</...
+ ``TOC``で検索。
+ ``Markdown All in One; 目次(TOC)の作成``を選択
+ 目次が挿入される。
* Log (ログ) の出力,確認 [#cf028932]
** rsyslog のインストール [#v35c6bb7]
sudo apt install rsyslog
** daemonの実行と再起動時の自動実行設定 [#pc9953d4]
```
sudo systemctl start rsyslog
sudo systemctl enable rsyslog
```
** log の確認 [#p6f095ed]
```
cat /var/log/syslog
```
- こんな感じの結果が出力されます。
> 2025-06-05T20:55:5+783155+09:00 wikijs node[638]: 2025-...
> 2025-06-05T20:56:03.162381+09:00 wikijs node[638]: 2025...
> 2025-06-05T20:56:03.180948+09:00 wikijs node[158]: 2025...
** 新規ユーザーや新規コメントの確認 [#g36a9337]
- 結局、上記のログでは新規ユーザーや新規コメントが確認で...
MariaDBから直に出力することにしました。
- ユーザーが増えたかどうか
```
SELECT id,email,name,timezone,createdAt,updatedAt,lastLo...
```
- コメントがあったかどうか
```
SELECT * FROM comments
```
* elasticsearchの導入 [#w33ca1d2]
- 普通にインストールしただけでは中身の検索ができないんで...
** install [#u48dc92a]
+ レポジトリの追加
```
sudo wget https://artifacts.elastic.co/GPG-KEY-elasticse...
sudo su -
echo "deb [signed-by=/etc/apt/keyrings/GPG-KEY-elasticse...
```
+ install
```
sudo apt update
sudo apt install apt-transport-https
sudo apt -y install elasticsearch
```
- 以下に表示されているパスワードをメモする
```
The generated password for the elastic built-in superus...
```
- アナライザ トークナイザ、「analysis-kuromoji」のインス...
```
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin ...
```
** 設定 [#x16eb8f3]
*** メモリ関連の設定 [#gfcacbe3]
```
sudo vim /etc/elasticsearch/jvm.options
```
- 以下を追加(値は各自のサーバ状況に合わせて下さい)
```
########################################################...
## IMPORTANT: JVM heap size
########################################################...
##
## The heap size is automatically configured by Elastics...
## based on the available memory in your system and the ...
## each node is configured to fulfill. If specifying hea...
## required, it should be done through a file in jvm.opt...
## which should be named with .options suffix, and the m...
## max should be set to the same value. For example, to ...
## heap to 4 GB, create a new file in the jvm.options.d
## directory containing these lines:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/ref...
## for more information
##
########################################################...
-Xms512m
-Xmx512m
```
- sslの無効化
- このファイル、どういうわけだかとても壊れやすいです。。。
なので最初にバックアップを取ります。
というか、NextCloudの方とも合わせて、ymlファイルが壊れて...
設定が間違えているのか区別が付かず、検証がちゃんと行えて...
なんかわからんけど動かない、なんかわからんけど動いた、っ...
```
sudo cp /etc/elasticsearch/elasticsearch.yml /etc/elasti...
```
```
sudo vim /etc/elasticsearch/elasticsearch.yml
```
```
# ======================== Elasticsearch Configuration =...
#
# NOTE: Elasticsearch comes with reasonable defaults for...
# Before you set out to tweak and tune the configu...
# understand what are you trying to accomplish and...
#
# The primary way of configuring a node is via this file...
# the most important settings you may want to configure ...
#
# Please consult the documentation for further informati...
# https://www.elastic.co/guide/en/elasticsearch/referenc...
#
# ---------------------------------- Cluster -----------...
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
cluster.name: wikijs
#
# ------------------------------------ Node ------------...
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------...
#
# Path to directory where to store the data (separate mu...
#
path.data: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------...
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the ...
# on the system and that the owner of the process is all...
# limit.
#
# Elasticsearch performs poorly when the system is swapp...
#
# ---------------------------------- Network -----------...
#
# By default Elasticsearch is only accessible on localho...
# address here to expose this node on the network:
#
#network.host: 192.168.0.1
#
# By default Elasticsearch listens for HTTP traffic on t...
# finds starting at 9200. Set a specific HTTP port here:
#
#http.port: 9200
#
# For more information, consult the network module docum...
#
# --------------------------------- Discovery ----------...
#
# Pass an initial list of hosts to perform discovery whe...
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-e...
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluste...
#
# ---------------------------------- Various -----------...
#
# Allow wildcard deletion of indices:
#
#action.destructive_requires_name: false
#----------------------- BEGIN SECURITY AUTO CONFIGURATI...
#
# The following settings, TLS certificates, and keys hav...
# generated to configure Elasticsearch security features...
#
# ------------------------------------------------------...
# Enable security features
xpack.security.enabled: false
xpack.security.enrollment.enabled: false
# Enable encryption for HTTP API client connections, suc...
xpack.security.http.ssl:
enabled: false
keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cl...
xpack.security.transport.ssl:
enabled: false
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["serverName"]
# Allow HTTP API connections from anywhere
# Connections are encrypted and require user authenticat...
http.host: 0.0.0.0
# Allow other nodes to join the cluster from anywhere
# Connections are encrypted and mutually authenticated
#transport.host: 0.0.0.0
#----------------------- END SECURITY AUTO CONFIGURATION...
```
*** elasticsearchデーモンの起動と自動起動設定 [#zacbc8d8]
```
sudo systemctl restart elasticsearch
sudo systemctl enable elasticsearch
```
** 動作確認 [#be1436d8]
- なんかしら帰ってきます。ブラウザでも確認可能
```
curl http://localhost:9200
```
** wiki.js側の設定 [#q5729b69]
- index(wikijs)は手動で作成せずとも wiki.js が自動で作り...
~~analysis-kuromoji だと自動で作らないのですが、それは w...
インストールは「analysis-kuromoji」なのですが、設定はた...
ここまで長かった。。。
- simple でも一応、日本語の検索もできました。。。
- (例では wikijs)
```
health status index uuid pri rep doc...
yellow open wikijs abcdefgabcdefg2JgCrqg 1 1 ...
```
+ 1秒から20秒へ
```bash
curl --noproxy '*' -X PUT "http://localhost:9200/wikijs/...
-H "Content-Type: application/json" \
-d '{ "index": { "refresh_interval": "20s" } }'
```
- 変更確認
```bash
curl --noproxy '*' -X GET "http://localhost:9200/wikijs...
```
* pukiwikiからの移行(置換概要) [#p0a80abd]
** 最初に [#v36ff523]
- "- + # * の右側に半角スペースを作っておきます。"
** * -> #(数の多い方からやっていきます) [#w452c87e]
+ 回目
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
*****
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
#####
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
****
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
####
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
***
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
###
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
**
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
##
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
*
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
#
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
** + -> + [#lb107a09]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オン
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
\+\+\+\+\+
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t\t\t+
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
\+\+\+\+
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t\t+
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
\+\+\+
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t+
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
\+\+
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t+
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
\+
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
+
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
** 「----」 -> Tab へ [#i70179eb]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オン
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
-----
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t\t\t-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
----
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t\t-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
---
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
--
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
-
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
** ハッシュタグの消去 [#s0f61ce6]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オン
- 置換元(行頭スペース必要)
```
\[.........\]
```
- 置換先(無)
```
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kb...
** リンクの変更 [#y37c98ea]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
+ 最初
- 置換元
```
[[
```
- 置換先
```
[
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 中間
- 置換元
```
:http
```
- 置換先
```
](http
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 末尾
- 置換元
```
]]
```
- 置換先
```
)
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
** 改行 [#y1dd0b51]
+ チルダ
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オン
- 置換元
```
~\n
```
- 置換先
```
\n\t
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ &br;
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元
```
&br;
```
- 置換先
```
<br>
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
** -- -> tabへ [#wf3ac968]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オン
- 置換元(スペースを入れないと結果が変わってしまうかも。。...
```
--
```
- 置換先(スペースを入れないと結果が変わってしまうかも。。...
```
\t-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kb...
** template [#ma62699f]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) :
- 置換元(スペースを入れないと結果が変わってしまうかも。。...
```
```
- 置換先(スペースを入れないと結果が変わってしまうかも。。...
```
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kb...
** あまりにも面倒なので python でプログラムを組みましたw ...
+ 最初に
+ 実行は自己責任でお願いします。
+ とりあえず動けば良いや、的なやっつけプログラムです。
+ python、始めて組んだんですが、まぁ他の言語と大差ないか...
なんでこんなに世間で話題になってるのか、いまいちわから...
+ 4時間位で作ったので、まだバグはありそうw
+ python の基本的な使い方は[こちら](/510-program/python/...
+ 機能
+ Listの後ろに半角スペースが無ければ追加
+ Tabの処理
+ \+ を + へ
+ \* を # へ
+ リンクを変更
- 例
- 変更前
```
[[Link:https://dummy.hoge.net]]
```
- 変更後
```
[Link](https://dummy.hoge.net)
```
+ 表を変換
+ #の下はタブ無しへ
+ 更新履歴
|日時|更新内容|
|-|-|
|2025/6/15 13:23|# or * 後のTab処理が反映されなかったの...
|2025/6/15 8:32|``&imgr(./image/keyboard/Mechanical-Jiku...
|2025/6/14 10:20 |# と表組みに対応|
|2025/6/9 10:20 |間違えて ' と指定した個所を ` へ修正|
{.dense}
+ その他
+ 以下2点が同時に発生する時、行頭のタブが一つ足りなくな...
ただ、自分にはちょっと無理かもしれない。。。
+ リストのインデントが増えたり減ったりする時(例) 「\t\t...
+ `` ``` ``を閉じる際
```
import re
import os
class CheckTabSharpClass:
def __init__(self) -> None:
self.tabCharacter = ""
self.sharpAsteriskFlag = False
self.tableFlag = False
def check( \
self \
,line\
):
afterReplaceCharacter=""
beforeReplaceCharacter=""
if line and line[0] in {"+", "-"}:
beforeReplaceCharacter = line[0]
if line and line[0] == "+":
afterReplaceCharacter = "+"
else:
afterReplaceCharacter = line[0]
beforeReplaceOrderList = ""
orderCount=0
newListLine=""
self.tabCharacter = ""
for characterOrder in line:
if characterOrder==" ":
break
else:
if orderCount==0:
beforeReplaceOrderList = characte...
newListLine = characterOrder.repl...
else:
beforeReplaceOrderList += charact...
newListLine = "\t" + newListLine
self.tabCharacter += "\t"
orderCount += 1
line = line.replace(beforeReplaceOrderList,ne...
if line and line[0]=="|":
self.tableFlag=True
else:
self.tableFlag=False
if line and line[0]=="*":
line = line.replace("*","#")
self.tabCharacter=""
self.sharpAsteriskFlag=True
elif self.tableFlag==False:
self.sharpAsteriskFlag=False
return line
def checkAddSpace(line):
headerSpace=""
spaceFlag= False
beforeReplace=""
for character in line:
if character==" ":
spaceFlag = True
headerSpace += character
break
elif character.startswith('*') \
or character.startswith('+') \
or character.startswith('-') \
:
pass
else:
beforeReplace = headerSpace
headerSpace = headerSpace + " "
break
headerSpace += character
if spaceFlag == False:
line= line.replace(beforeReplace,headerSpace)
return line
class CreateTabTextClass:
def __init__(self) -> None:
self.codeFlag=False
self.codeHeadTab=""
self.tableFlag=False
def CreateTabText( \
self \
,eachLine \
,checkTabSharpClass \
):
tabCharacter=""
returnEachLine=""
returnEachLine=eachLine
if checkTabSharpClass.sharpAsteriskFlag==False \
and checkTabSharpClass.tableFlag==False:
tabCharacter="\t"
self.codeHeadTab=""
if eachLine.startswith(" "):
if self.codeFlag == False:
self.codeHeadTab = tabCharacter + checkTa...
returnEachLine = self.codeHeadTab + tabCharac...
self.codeFlag=True
elif eachLine.startswith(' ')==False \
and self.codeFlag==True :
returnEachLine = self.codeHeadTab + tabCharac...
self.codeFlag=False
if eachLine.replace("\t","").startswith("|"):
tableSeparate="|"
if self.tableFlag==False:
for pipeCount in range(1, eachLine.count(...
tableSeparate+="-|"
returnEachLine= tabCharacter + checkTabSh...
+ tabCharacter + che...
self.tableFlag=True
else:
returnEachLine= tabCharacter + checkTabSh...
elif self.tableFlag==True \
and eachLine.replace("\t","").startswith(...
:
self.tableFlag=False
return returnEachLine
class ConvertImgrClass:
def convert(self, argEachLine):
eachLine=argEachLine
afterSplitComma=[]
afterSplitSlash=[]
imgFileName=""
afterSplitComma=eachLine.split(",")
afterSplitSlash=afterSplitComma[0].split("/")
imgFileName=afterSplitSlash[-1].lower()
eachLine=":
try:
checkTabSharpClass = CheckTabSharpClass()
createTabTextClass = CreateTabTextClass()
convertImgrClass = ConvertImgrClass()
eachLine=""
outputText=""
for line in inputLines:
eachLine=line
if \
eachLine.startswith('*') \
or eachLine.startswith('+') \
or eachLine.startswith('-') \
or eachLine.startswith('|') \
:
#Spaceが無い場合に追加
if eachLine.startswith('|')==False:
eachLine = checkAddSpace(eachLine)
#Tabと * の処理
eachLine = checkTabSharpClass.check(e...
eachLine=re.sub(r" \[.........\]", ""...
eachLine=re.sub(r"\[.........\]", "",...
eachLine=createTabTextClass.CreateTabText...
e...
,...
...
if "&imgr" in eachLine:
eachLine=convertImgrClass.convert(eac...
eachLine=eachLine.replace("~","")
eachLine=eachLine.replace("[[","[")
eachLine=eachLine.replace(":http","](http")
eachLine=eachLine.replace("]]",")")
eachLine=eachLine.replace("''","**")
eachLine=eachLine.replace("&br;","<br>")
eachLine=eachLine.replace("|h","|")
outputText+=eachLine
del createTabTextClass
del checkTabSharpClass
del convertImgrClass
return outputText
except:
import traceback
traceback.print_exc()
* ファイル単位で処理する場合 [#p957c8bf]
inputFileName="input.pukiwiki"
outputFileName="output.wikijs"
with open('pukiwikiWikijsSource\\'+inputFileName, 'r', en...
open('pukiwikiWikijsSource\\'+outputFileName, 'w', e...
transFormLineClass = TransFormLineClass()
inputLines=[]
for line in infile:
inputLines.append(line)
outputText=""
outputText=transFormLineClass.transform_line(inputLin...
if outputText is not None and isinstance(outputText, ...
outfile.write(outputText)
del transFormLineClass
```
+ PlantUML,シーケンス図
+
```
@startuml sequence
title pukiwiki -> wiki.js 変換プログラム
participant main
participant TransFormLineClass
participant CheckTabSharpClass
participant CreateTabTextClass
Activate main
note right main
inputFileName="input.pukiwiki"
outputFileName="output.wikijs"
open input.pukiwiki
open output.wikijs
end note
loop foreach line in input file
note right main
inputLines.append(line)
end note
end
note right main
outputText=transFormLineClass.transform_line(inputLines)
end note
main -> TransFormLineClass: transform_line(self, input...
Activate TransFormLineClass
note right TransFormLineClass
checkTabSharpClass = CheckTabSharpClass()
createTabTextClass = CreateTabTextClass()
eachLine=""
outputText=""
end note
TransFormLineClass -> CheckTabSharpClass
activate CheckTabSharpClass
TransFormLineClass -> CreateTabTextClass
activate CreateTabTextClass
loop foreach line in inputLines
note right TransFormLineClass
eachLine = line
end note
alt eachLine.startswith('*') or eachLine.startswith('...
alt eachLine.startswith('|')==False
TransFormLineClass -> main: checkAddSpace
note right TransFormLineClass
+ # - のあとに半角スペースが無ければ挿入
end note
activate main
main --> TransFormLineClass: eachLine
deactivate main
end
TransFormLineClass -> CheckTabSharpClass: check(each...
note right CheckTabSharpClass
afterReplaceCharacter=""
beforeReplaceCharacter=""
end note
alt line and line[0] in {"+", "-"}
note right CheckTabSharpClass
+ を + へ変更
beforeReplaceOrderList = ""
orderCount=0
newListLine=""
end note
loop characterOrder in line
alt characterOrder==" "
note right CheckTabSharpClass
何文字目かの文字(foreach)が、半角スペース(もう終...
break
end note
else
alt orderCount==0
note right CheckTabSharpClass
文字が - か + で、かつ最初の文字の時
beforeReplaceOrderList = characterOrder
newListLine = characterOrder.replace(beforeRepl...
end note
else
note right CheckTabSharpClass
文字が - か + で、かつ2文字目以降(タブの追加)
beforeReplaceOrderList += characterOrder
newListLine = "\ t" + newListLine
self.tabCharacter += "\ t"
end note
end
end
note right CheckTabSharpClass
orderCount += 1
end note
end
note right CheckTabSharpClass
line = line.replace(beforeReplaceOrderList,newList...
end note
end
alt line and line[0]=="|"
note right CheckTabSharpClass
self.tableFlag=True
end note
else
note right CheckTabSharpClass
self.tableFlag=False
end note
end
alt line and line[0]=="*"
note right CheckTabSharpClass
line = line.replace("*","#")
self.tabCharacter=""
self.sharpAsteriskFlag=True
end note
else self.tableFlag==False
note right CheckTabSharpClass
self.sharpAsteriskFlag=False
end note
end
CheckTabSharpClass --> TransFormLineClass: eachLine=...
note right TransFormLineClass
ハッシュタグの消去
end note
end
TransFormLineClass -> CreateTabTextClass:createTabTex...
note right CreateTabTextClass
tabCharacter=""
returnEachLine=""
returnEachLine=eachLine
end note
alt checkTabSharpClass.sharpAsteriskFlag==False
note right CreateTabTextClass
tabCharacter="\ t"
end note
end
alt checkTabSharpClass.tableFlag==False
note right CreateTabTextClass
tabCharacter="\ t"
end note
end
alt self.eachLine.startswith(" "):
alt self.codeFlag == False
note right CreateTabTextClass
self.codeHeadTab = tabCharacter + "```\n"
end note
end
note right CreateTabTextClass
returnEachLine = self.codeHeadTab + tabCharacter + ...
self.codeFlag=True
end note
else self.eachLine.startswith(' ')==False and self.co...
note right CreateTabTextClass
returnEachLine = tabCharacter + "```\n" + eachLine
self.codeFlag=False
end note
end
alt eachLine.replace("\ t","").startswith("|")
note right CreateTabTextClass
tableSeparate="|"
end note
alt eachLine.replace("\t","").startswith("|")
note right CreateTabTextClass
tableSeparate="|"
end note
loop pipeCount in range(1, eachLine.count("|"))
note right CreateTabTextClass
tableSeparate+="-|"
end note
end
note right CreateTabTextClass
returnEachLine= tabCharacter + checkTabSharpClass....
+ tabCharacter + checkTabSharpClass.tabCharac...
self.tableFlag=True
end note
else
note right CreateTabTextClass
returnEachLine= tabCharacter + checkTabSharpClass....
end note
end
else self.tableFlag==True and eachLine.replace("\t","...
note right CreateTabTextClass
self.tableFlag=False
end note
end
CreateTabTextClass --> TransFormLineClass:returnEachL...
note right TransFormLineClass
eachLine=eachLine.replace("~","")
eachLine=eachLine.replace("[[","[")
eachLine=eachLine.replace(":http","](http")
eachLine=eachLine.replace("]]",")")
eachLine=eachLine.replace("''","**")
outputText+=eachLine
end note
end
TransFormLineClass --> main: outputText ...
deActivate CreateTabTextClass
deActivate CheckTabSharpClass
deActivate TransFormLineClass
note right main
outfile.write(outputText)
end note
@enduml
```
+  なぜか vim をインストール後、かつsshの状態で、...
- とりあえず、<kbd>Shift</kbd> + <kbd>Insert</kbd>で緊急...
- あとはバックスペースが効かないとか。。。一応、以下にま...
- [vi,vim(wiki.js)](https://wikijs.tar3.net:3443/ja/310-...
* コメントをフルオープンにした場合、どれくらいスパムが来...
- 2025/6/20 7:15~
- そのうち結果を書きます
- 2025/6/30(18:00):今のところスパムは無いです。このまま...
* upgrade [#j1a2f611]
-[[公式ページリンク:https://docs.requarks.io/install/upgr...
- Run to need by super user.
+ Stop the running Wiki.js instance
systemctl stop wikijs
+ Make a backup of your config.yml file.
cp wiki/config.yml ~/config.yml.bak
+ Change folder name
mv wikijs wikijsBak
+ create directory
mkdir wikijs
cd wikijs
+ Download the latest version of Wiki.js.
wget https://github.com/Requarks/wiki/releases/latest/do...
+ Extract the package
tar xzfv wiki-js.tar.gz
+ If created the link of data directory
rm -fr data
ln -s /mnt/target/directory data
+ Restore your config.yml back to its original location.
cp ~/config.yml.bak ./config.yml
+ start wiki.js
systemctl start wikijs
+ If no problem, delete the backup folder.
rm -fr ../wikijsBak
終了行:
[[LinuxServer]]
#contents();
* なぜ pukiwiki から wiki.js へ移行しようと思ったか 1 [#w...
+ コメントの受け付けしたい
+ スパムがやだ
+ 過去にストーカー被害にあったこともあり、特定のユーザー...
+ ユーザーが、ユーザー自身を登録できる wiki が良いなぁ。...
** なぜ pukiwiki から wiki.js へ移行しようと思ったか 2 [#...
- 自分、 markdown 言語が大好きだから。
- 正直、書いてると落ち着きます。。。
* 公式リンク(top) [#x2afee6a]
-[Wiki.js](https://docs.requarks.io/)
** Editor - Markdown [#uaa8ce5b]
-[Editors - Markdown](https://docs.requarks.io/editors/ma...
** Editor - MarkDown(日本語) [#ib839f7d]
-[(designet)8. エディターの使用方法](https://www.designet...
* 前提 [#o12d77ef]
** 環境 [#ibd58668]
- proxmoxのコンテナを使います。
- proxmox については[こちら(当方 pukiwiki )](https://tar3...
** 他に検討したもの [#ycc2e6ce]
- Growi -> mongodbにおいて CPUは avx に対応したものが必要...
うちのサーバのCPUでは対応してませんでした。。。(2009年製...
まぁしようがないですね(^^;)
- wikiを比較する際は、以下のサイトを参考にしました。~
-- [(designet) 社内Wikiのおすすめツールとは?無料で使える...
* 構築 [#b2a4ac2f]
** 構築コマンド [#b4113ec3]
- [(参考サイト) wiki.js(lxc) Proxmox VE Helper-Scripts](h...
- どれかのホストで以下のコマンドを実行
- インストール時、色々聞かれるようにカスタムインストール...
sudo su -
bash -c "$(curl -fsSL https://raw.githubusercontent.com/...
** MariaDBへ切り替え [#ja687771]
*** なぜ? [#f96f037a]
- 以下に「メディア資産管理」の項目を書くのですが、作った...
データベースを直にいじるので、使い慣れている MariaDB(MySQ...
*** 参考サイト [#hb3a54c6]
- [[参考サイト(Nginx : Wiki.js インストール):https://www....
*** MariaDB のインストールと自動起動設定,起動 [#n201138a]
sudo apt install mariadb-server
sudo apt start mariadb
sudo apt enable mariadb
*** 初期設定 [#a249db48]
sudo mysql_secure_installation
- 概要
+ Unix_Socket 認証に切り替えるか否か~
[no] でも root のみ デフォルトで Unix_Socket 認証は有効~
Switch to unix_socket authentication [Y/n] n
+ MariaDB root パスワードを設定するか否か
MariaDBへ root パスワードでもログインできるようになる。~
不要と言えば不要なんだけど、自分はバックアップの設定もあ...
Change the root password? [Y/n] y~
+ 匿名ユーザーは削除する~
Remove anonymous users? [Y/n] y
+ root のリモートログインは無効とする~
Disallow root login remotely? [Y/n] y
+ テストデータベースは削除する~
Remove test database and access to it? [Y/n] y
+ 特権情報をリロードする~
Reload privilege tables now? [Y/n] y
+ インストール完了
*** (MariaDB) wiki.js用ユーザーの作成とデータベースの作成...
+ root ユーザーでログイン
mysql
+ データベースの作成
create database wikijs;
+ 権限の設定とパスワードの設定
grant all privileges on wikijs.* to wikijs@'localhost' i...
+権限の更新
flush privileges;
+ MariaDBから出る。
exit
*** wiki.js の変更 [#r234b69b]
- できるだけ元の設定は残しておいた方が良いかもです。~
行頭に「#」を付けるとコメント・アウトになります。
sudo vi /opt/wikijs/config.yml
db:
type: mariadb
# PostgreSQL / MySQL / MariaDB / MS SQL Server only:
host: localhost
port: 3306
user: wikijs
pass: password
db: wikijs
ssl: false
*** backup [#h66719fb]
[[こちらを参照(mysql):/310-Linux/313-LinuxServer/mysql#my...
* 設定変更 [#yccb94ab]
** config.yml の場所,Path [#a7cdf876]
- ``/opt/wikijs/config.yml``~
- システム情報で確認できます。~
-- 化 [#zbdb2519]
+ key と crt は適当なディレクトリへ保存~
(自分はLet's Encryptは使ってません。有償の証明書を持って...
- 中間証明書は要らないのかな?この辺、良くわかってないで...
- ssl の port は 3443 にしています。
sudo vi /opt/wikijs/config.yml
# ------------------------------------------------------...
# SSL/TLS Settings
# ------------------------------------------------------...
# Consider using a reverse proxy (e.g. nginx) if you req...
# advanced options than those provided below.
ssl:
#enabled: false
enabled: true
port: 3443
# Provider to use, possible values: custom, letsencrypt
provider: custom
#provider: letsencrypt
# ++++++ For custom only ++++++
# Certificate format, either 'pem' or 'pfx':
format: pem
# Using PEM format:
# key
key: /etc/pki/tls/certs/server.key
# 証明書
cert: /etc/pki/tls/certs/server.crt
# Using PFX format:
#pfx: path/to/cert.pfx
# Passphrase when using encrypted PEM / PFX keys (defaul...
passphrase: null
# Diffie Hellman parameters, with key length being great...
# to 1024 bits (default: null):
dhparam: null
# ++++++ For letsencrypt only ++++++
domain: wikijp.tar3.net
subscriberEmail: hogehoge@unyaunya.net
** dataPAth: の変更 [#u6671d64]
- なんか容量食うと嫌なので普通にファイルサーバのPathを指...
dataPath: /mnt/hogehoge/data/unya/wikijs
- config.yml の変更は以上です。大したことないですね(^^)
** faviconの変更 [#t9c20831]
+ favicon.ico
-- path
--- /opt/wikijs/assets/favicon.ico
-- 画像解像度
--- 48 x 48
+ favicons ディレクトリ
-- path
--- /opt/wikijs/assets/favicons/
|ファイル名|解像度|h
|android-chrome-192x192.png|192 x 192|
|android-chrome-256x256.png|256 x 256|
|apple-touch-icon.png|180 x 180|
|favicon-16x16.png|16 x 16|
|favicon-32x32.png|32 x 32|
|mstile-150x150.png|150 x 150|
{.dense}
** Web画面からの設定変更 [#j17d18f5]
*** 全般設定 [#vd21e5e9]
- サイトのURL
- サイトのタイトル
- ロゴURL
*** 言語 [#u0b795b1]
- 日本語
*** ナビゲーション [#lf137ea2]
- サイトツリー
*** グループ [#ubd17f40]
- registerdUsers を追加。どなたかが新規にアカウントを作っ...
*** アナリティクス [#vf8039e5]
- google analytics を設定
-- Tracking ID の確認方法
-- Google Analytics -> 左側「データの収集と修正」 -> 「デ...
--- 対象のアカウントをクリック
--- 「測定ID」が Tracking ID です。
*** セキュリティ [#x465f8f5]
- アップロード
-- 最大アップロードサイズ
104857600
-- 1回あたりの最大ファイル数
50
* 記事の作成関連 [#ocf60189]
** markdown [#wac1c10f]
*** User's manual(公式) [#u26a34fb]
- [wiki.js - Markdown](https://docs.requarks.io/editors/m...
++ [image](https://docs.requarks.io/editors/markdown#imag...




++ [Keyboard Keys](https://docs.requarks.io/editors/markd...
Lorem ipsum dolor <kbd>CTRL</kbd> + <kbd>C</kbd>
++ [Links](https://docs.requarks.io/editors/markdown*links)
[Lorem ipsum](https://wiki.js.org/about)
--- ページ内の見出しへリンクする
---- Link先の取得(見出しをマウスオーバーすると右側にリン...
ここを右クリックしてリンクをコピーするとハッシュタグが取...
----- ](/310-Linux/313-LinuxServer/mysql#m...
++ [table](https://docs.requarks.io/editors/markdown#table)
| Header 1 | Header 2 | Header 3 |
|--------- |--------- | -------- |
| Foo | Bar | Xyz |
| Abc | Def | 123 |
{.dense}
++ 色
--- [参考サイト(Change text color on pages)](https://feed...
<span style='color:green;'>緑色の文字</span>
*** 書式の設定方法(参考サイト) [#f3ec7cd7]
- [[参考サイト1: Wiki hina.dev:https://wiki.o.hina.dev/wi...
-- 太字
-- イタリック
-- 取り消し線
-- 見出し
-- 下付き文字
-- 上付き文字
-- ブロック引用
-- 順序つきリスト
-- 順序無しリスト
-- タスクリスト
-- インラインコード
-- コードブロック
-- 水平線
-- 画像
-- リンク
-- キーボードキー
*** designet(参考サイト) [#acbf30cd]
- [[(designet) 8. エディターの使用方法:https://www.design...
**** ブロッククォート(箇条書きと組み合わせない場合、使用...
> スタイルなし eee
> .is-info aaa
{.is-info}
> .is-succsess bbb
{.is-success}
> .is-warning ccc
{.is-warning}
> .is-danger ddd
{.is-danger}
> スタイルなし eee
> .is-info aaa
{.is-info}
> .is-succsess bbb
{.is-success}
> .is-warning ccc
{.is-warning}
> .is-danger ddd
{.is-danger}
**** 脚注 [#u66a07c1]
This sentence[^1] needs a few footnotes.[^2]
[^1]: A string of syntactic words.
[^2]: A useful example sentence.
This sentence[^1] needs a few footnotes.[^2]
[^1]: A string of syntactic words.
[^2]: A useful example sentence.
**** キーボード,<kbd></kbd> [#o5ebdca1]
<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>o</kbd>
**** tabset [#z6fe40d1]
### タブ {.tabset}
#### タブ aaa
タブの記事
#### タブ bbb
タブの記事2
### タブ {.tabset}
#### タブ aaa
タブの記事
#### タブ bbb
タブの記事2
* メディア資産(画像など)の管理 [#j7f529ec]
- 以下のような感じの所ですね。
](/310-Linux/313-LinuxS...
{.is-warning}
** 前提条件 [#z1d15d01]
- データベースはMariaDBです。
- /opt/wikijs/config.yml の dataPath
/mnt/hoge/munya/wikijs
** 関連情報は3つ [#wd8e6fbb]
+ データベース(MariaDB)
++ assets
++ assetFolders
+ dataPath
++ /mnt/hoge/munya/wikijs/imagedirectorya/imagedirectoryb...
** table の desc 情報 [#v7af81ea]
+ assets
| Field | Type | Null | Key | Defau...
|-----------|------------------------|------|-----|------...
| id | int(10) unsigned | NO | PRI | NULL ...
| filename | varchar(255) | NO | | NULL ...
| hash | varchar(255) | NO | | NULL ...
| ext | varchar(255) | NO | | NULL ...
| kind | enum('binary','image') | NO | | binar...
| mime | varchar(255) | NO | | appli...
| fileSize | int(10) unsigned | YES | | NULL ...
| metadata | longtext | YES | | NULL ...
| createdAt | varchar(255) | NO | | NULL ...
| updatedAt | varchar(255) | NO | | NULL ...
| folderId | int(10) unsigned | YES | MUL | NULL ...
| authorId | int(10) unsigned | YES | MUL | NULL ...
{.dense}
+ assetFolders
| Field | Type | Null | Key | Default | Ex...
|----------|------------------|------|-----|---------|---...
| id | int(10) unsigned | NO | PRI | NULL | au...
| name | varchar(255) | NO | | NULL | ...
| slug | varchar(255) | NO | | NULL | ...
| parentId | int(10) unsigned | YES | MUL | NULL | ...
{.dense}
** 概要 [#p46d137a]
+ assets が画像情報の格納先です。
-- folderID で assetFolders へ正規化されています。~
ここで紐づけられたフォルダに画像が入っている必要がありま...
+ assetFolders は、親フォルダ名を持ってるだけで一般的な基...
-- フォルダ名はここで決まります。
** 場面ごとの変更方法(MariaDBでの変更方法) [#j62758ad]
- さて、実際どのように情報を変えていくかを記載していきま...
- wikiの画像参照リンクの変更も必要です。
*** 共通 [#sf214f8d]
- MariaDBへのログインとデータベースの変更~
(wikijsのMariaDBのあるサーバで実行)
sudo mysql
use wikijs
- assets と assetFolders のデータを確認
SELECT * FROM assets;
SELECT * FROM assetFolders;
*** メディア資産で表示されるフォルダ名の変更 [#p0a4ef74]
- id は上記の「SELECT * FROM assetFolders;」で表示された...
> WHERE 句を入れないと全部のフォルダー名が一律に変わって...
このミスは慣れた頃に起きるのと、結構データベースに精通し...
データベースのバックアップは重要です。
{.is-warning}
UPDATE assetFolders SET name='imagedirectoryc', slug='im...
*** メディア資産で表示されるフォルダ名の削除 [#w86ec377]
- 消す前に以下はやりましょう~。(要は以下の「[メディア資...
++ データベース情報の変更
++ サーバの物理Pathから別のフォルダへ画像を移動(mv コマン...
++ フォルダ内にある画像のリンク元の変更(``
DELETE FROM assetFolders WHERE id=2;
*** メディア資産で表示される画像ファイルのフォルダ移動 [#...
+ 正直、これは画像を再アップロードした方が早いかもしんないw
+ WHERE の後ろのIDは、対象の画像ファイルのid~
folderIdは上記「SELECT * FROM assetFolders;」の結果から変...
update assets SET folderId=35 WHERE id>=24 and id<=36;
+ Linuxサーバ上のファイルを移動
-- 例) imagedirectory<span style='color:red;'>**b**</span...
mv /mnt/hoge/munya/wikijs/imagedirectorya/imagedirectory...
+ イメージリンクを変更
-- 前(例) imagedirectory<span style='color:red;'>**b**</s...

を使用 [#kee28da4]
** おすすめ拡張機能 [#te88fa5d]
+ Markdown Preview Enhanced
+ Markdown All in One
*** 使い方(Markdown Preview Enhanced) [#afe5edc3]
- <kbd>Ctrl</kbd> + <kbd>k</kbd> <kbd>v</kbd>
- [Manual(markdown-preview-enhanced)](https://shd101wyy.g...
*** 使い方(Markdown All in One) [#z3c2d8a3]
- 特に特別な事は無いんですが、<kbd>Shift</kbd> + <kbd>Ent...
- 変更前
-- <kbd>Shift</kbd> + <kbd>Enter</kbd>で改行できない時が...
- 変更後
-- 基本的に<kbd>Shift</kbd> + <kbd>Enter</kbd>で改行でき...
- 変更方法
-- 「ファイル」 -> 「ユーザー設定」->「キーボードショート...
-- 「markdown.extension.onShiftEnterKey」で検索
-- 右クリック「When 式を変更」
-- 以下としました
editorTextFocus && !editorHasMultipleSelections && !edit...
-- 残したのは以下
--- エディターにフォーカス
--- 複数選択してない
--- エディターは読み取り専用ではない
--- エディターの言語は markdown である
--- マルチプルセレクションではない(すみません、これ良く分...
--- markdown拡張機能のエディターカーソルがCodeBlockでない...
(なのですが、CodeBlock内でも<kbd>Shift</kbd> + <kbd>Enter...
--- カーソルが MathEnv でないとき
--- あとは等々
** vscode 共通機能の設定についてはこちら [#j819535d]
- [vscode:設定](/510-program/vscode/vscode#%E8%A8%AD%E5%A...
** (vscode) 目次の作成方法 [#c7a45e33]
- wiki.jsは左側のサマリが見出し2までしか表示できないです。
個人的にはこれがかなりネックだったのですが、目次を作る事...
+ 目次を作成したい個所にカーソルを移動
+ vscode上で<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>p</...
+ ``TOC``で検索。
+ ``Markdown All in One; 目次(TOC)の作成``を選択
+ 目次が挿入される。
* Log (ログ) の出力,確認 [#cf028932]
** rsyslog のインストール [#v35c6bb7]
sudo apt install rsyslog
** daemonの実行と再起動時の自動実行設定 [#pc9953d4]
```
sudo systemctl start rsyslog
sudo systemctl enable rsyslog
```
** log の確認 [#p6f095ed]
```
cat /var/log/syslog
```
- こんな感じの結果が出力されます。
> 2025-06-05T20:55:5+783155+09:00 wikijs node[638]: 2025-...
> 2025-06-05T20:56:03.162381+09:00 wikijs node[638]: 2025...
> 2025-06-05T20:56:03.180948+09:00 wikijs node[158]: 2025...
** 新規ユーザーや新規コメントの確認 [#g36a9337]
- 結局、上記のログでは新規ユーザーや新規コメントが確認で...
MariaDBから直に出力することにしました。
- ユーザーが増えたかどうか
```
SELECT id,email,name,timezone,createdAt,updatedAt,lastLo...
```
- コメントがあったかどうか
```
SELECT * FROM comments
```
* elasticsearchの導入 [#w33ca1d2]
- 普通にインストールしただけでは中身の検索ができないんで...
** install [#u48dc92a]
+ レポジトリの追加
```
sudo wget https://artifacts.elastic.co/GPG-KEY-elasticse...
sudo su -
echo "deb [signed-by=/etc/apt/keyrings/GPG-KEY-elasticse...
```
+ install
```
sudo apt update
sudo apt install apt-transport-https
sudo apt -y install elasticsearch
```
- 以下に表示されているパスワードをメモする
```
The generated password for the elastic built-in superus...
```
- アナライザ トークナイザ、「analysis-kuromoji」のインス...
```
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin ...
```
** 設定 [#x16eb8f3]
*** メモリ関連の設定 [#gfcacbe3]
```
sudo vim /etc/elasticsearch/jvm.options
```
- 以下を追加(値は各自のサーバ状況に合わせて下さい)
```
########################################################...
## IMPORTANT: JVM heap size
########################################################...
##
## The heap size is automatically configured by Elastics...
## based on the available memory in your system and the ...
## each node is configured to fulfill. If specifying hea...
## required, it should be done through a file in jvm.opt...
## which should be named with .options suffix, and the m...
## max should be set to the same value. For example, to ...
## heap to 4 GB, create a new file in the jvm.options.d
## directory containing these lines:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/ref...
## for more information
##
########################################################...
-Xms512m
-Xmx512m
```
- sslの無効化
- このファイル、どういうわけだかとても壊れやすいです。。。
なので最初にバックアップを取ります。
というか、NextCloudの方とも合わせて、ymlファイルが壊れて...
設定が間違えているのか区別が付かず、検証がちゃんと行えて...
なんかわからんけど動かない、なんかわからんけど動いた、っ...
```
sudo cp /etc/elasticsearch/elasticsearch.yml /etc/elasti...
```
```
sudo vim /etc/elasticsearch/elasticsearch.yml
```
```
# ======================== Elasticsearch Configuration =...
#
# NOTE: Elasticsearch comes with reasonable defaults for...
# Before you set out to tweak and tune the configu...
# understand what are you trying to accomplish and...
#
# The primary way of configuring a node is via this file...
# the most important settings you may want to configure ...
#
# Please consult the documentation for further informati...
# https://www.elastic.co/guide/en/elasticsearch/referenc...
#
# ---------------------------------- Cluster -----------...
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
cluster.name: wikijs
#
# ------------------------------------ Node ------------...
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------...
#
# Path to directory where to store the data (separate mu...
#
path.data: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------...
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the ...
# on the system and that the owner of the process is all...
# limit.
#
# Elasticsearch performs poorly when the system is swapp...
#
# ---------------------------------- Network -----------...
#
# By default Elasticsearch is only accessible on localho...
# address here to expose this node on the network:
#
#network.host: 192.168.0.1
#
# By default Elasticsearch listens for HTTP traffic on t...
# finds starting at 9200. Set a specific HTTP port here:
#
#http.port: 9200
#
# For more information, consult the network module docum...
#
# --------------------------------- Discovery ----------...
#
# Pass an initial list of hosts to perform discovery whe...
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-e...
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluste...
#
# ---------------------------------- Various -----------...
#
# Allow wildcard deletion of indices:
#
#action.destructive_requires_name: false
#----------------------- BEGIN SECURITY AUTO CONFIGURATI...
#
# The following settings, TLS certificates, and keys hav...
# generated to configure Elasticsearch security features...
#
# ------------------------------------------------------...
# Enable security features
xpack.security.enabled: false
xpack.security.enrollment.enabled: false
# Enable encryption for HTTP API client connections, suc...
xpack.security.http.ssl:
enabled: false
keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cl...
xpack.security.transport.ssl:
enabled: false
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["serverName"]
# Allow HTTP API connections from anywhere
# Connections are encrypted and require user authenticat...
http.host: 0.0.0.0
# Allow other nodes to join the cluster from anywhere
# Connections are encrypted and mutually authenticated
#transport.host: 0.0.0.0
#----------------------- END SECURITY AUTO CONFIGURATION...
```
*** elasticsearchデーモンの起動と自動起動設定 [#zacbc8d8]
```
sudo systemctl restart elasticsearch
sudo systemctl enable elasticsearch
```
** 動作確認 [#be1436d8]
- なんかしら帰ってきます。ブラウザでも確認可能
```
curl http://localhost:9200
```
** wiki.js側の設定 [#q5729b69]
- index(wikijs)は手動で作成せずとも wiki.js が自動で作り...
~~analysis-kuromoji だと自動で作らないのですが、それは w...
インストールは「analysis-kuromoji」なのですが、設定はた...
ここまで長かった。。。
- simple でも一応、日本語の検索もできました。。。
- (例では wikijs)
```
health status index uuid pri rep doc...
yellow open wikijs abcdefgabcdefg2JgCrqg 1 1 ...
```
+ 1秒から20秒へ
```bash
curl --noproxy '*' -X PUT "http://localhost:9200/wikijs/...
-H "Content-Type: application/json" \
-d '{ "index": { "refresh_interval": "20s" } }'
```
- 変更確認
```bash
curl --noproxy '*' -X GET "http://localhost:9200/wikijs...
```
* pukiwikiからの移行(置換概要) [#p0a80abd]
** 最初に [#v36ff523]
- "- + # * の右側に半角スペースを作っておきます。"
** * -> #(数の多い方からやっていきます) [#w452c87e]
+ 回目
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
*****
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
#####
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
****
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
####
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
***
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
###
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
**
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
##
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
*
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
#
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
** + -> + [#lb107a09]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オン
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
\+\+\+\+\+
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t\t\t+
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
\+\+\+\+
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t\t+
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
\+\+\+
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t+
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
\+\+
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t+
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
\+
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
+
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
** 「----」 -> Tab へ [#i70179eb]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オン
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
-----
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t\t\t-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
----
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t\t-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
---
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t\t-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
--
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
\t-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 回目
- 置換元(スペースを入れないとurlも変わってしまうかも。。...
```
-
```
- 置換先(スペースを入れないとurlも変わってしまうかも。。...
```
-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
** ハッシュタグの消去 [#s0f61ce6]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オン
- 置換元(行頭スペース必要)
```
\[.........\]
```
- 置換先(無)
```
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kb...
** リンクの変更 [#y37c98ea]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
+ 最初
- 置換元
```
[[
```
- 置換先
```
[
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 中間
- 置換元
```
:http
```
- 置換先
```
](http
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ 末尾
- 置換元
```
]]
```
- 置換先
```
)
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
** 改行 [#y1dd0b51]
+ チルダ
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オン
- 置換元
```
~\n
```
- 置換先
```
\n\t
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
+ &br;
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オフ
- 置換元
```
&br;
```
- 置換先
```
<br>
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <k...
** -- -> tabへ [#wf3ac968]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) : オン
- 置換元(スペースを入れないと結果が変わってしまうかも。。...
```
--
```
- 置換先(スペースを入れないと結果が変わってしまうかも。。...
```
\t-
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kb...
** template [#ma62699f]
- 正規表現(<kbd>Alt</kbd> + <kbd>r</kbd>) :
- 置換元(スペースを入れないと結果が変わってしまうかも。。...
```
```
- 置換先(スペースを入れないと結果が変わってしまうかも。。...
```
```
- 全部まとめて変換(<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kb...
** あまりにも面倒なので python でプログラムを組みましたw ...
+ 最初に
+ 実行は自己責任でお願いします。
+ とりあえず動けば良いや、的なやっつけプログラムです。
+ python、始めて組んだんですが、まぁ他の言語と大差ないか...
なんでこんなに世間で話題になってるのか、いまいちわから...
+ 4時間位で作ったので、まだバグはありそうw
+ python の基本的な使い方は[こちら](/510-program/python/...
+ 機能
+ Listの後ろに半角スペースが無ければ追加
+ Tabの処理
+ \+ を + へ
+ \* を # へ
+ リンクを変更
- 例
- 変更前
```
[[Link:https://dummy.hoge.net]]
```
- 変更後
```
[Link](https://dummy.hoge.net)
```
+ 表を変換
+ #の下はタブ無しへ
+ 更新履歴
|日時|更新内容|
|-|-|
|2025/6/15 13:23|# or * 後のTab処理が反映されなかったの...
|2025/6/15 8:32|``&imgr(./image/keyboard/Mechanical-Jiku...
|2025/6/14 10:20 |# と表組みに対応|
|2025/6/9 10:20 |間違えて ' と指定した個所を ` へ修正|
{.dense}
+ その他
+ 以下2点が同時に発生する時、行頭のタブが一つ足りなくな...
ただ、自分にはちょっと無理かもしれない。。。
+ リストのインデントが増えたり減ったりする時(例) 「\t\t...
+ `` ``` ``を閉じる際
```
import re
import os
class CheckTabSharpClass:
def __init__(self) -> None:
self.tabCharacter = ""
self.sharpAsteriskFlag = False
self.tableFlag = False
def check( \
self \
,line\
):
afterReplaceCharacter=""
beforeReplaceCharacter=""
if line and line[0] in {"+", "-"}:
beforeReplaceCharacter = line[0]
if line and line[0] == "+":
afterReplaceCharacter = "+"
else:
afterReplaceCharacter = line[0]
beforeReplaceOrderList = ""
orderCount=0
newListLine=""
self.tabCharacter = ""
for characterOrder in line:
if characterOrder==" ":
break
else:
if orderCount==0:
beforeReplaceOrderList = characte...
newListLine = characterOrder.repl...
else:
beforeReplaceOrderList += charact...
newListLine = "\t" + newListLine
self.tabCharacter += "\t"
orderCount += 1
line = line.replace(beforeReplaceOrderList,ne...
if line and line[0]=="|":
self.tableFlag=True
else:
self.tableFlag=False
if line and line[0]=="*":
line = line.replace("*","#")
self.tabCharacter=""
self.sharpAsteriskFlag=True
elif self.tableFlag==False:
self.sharpAsteriskFlag=False
return line
def checkAddSpace(line):
headerSpace=""
spaceFlag= False
beforeReplace=""
for character in line:
if character==" ":
spaceFlag = True
headerSpace += character
break
elif character.startswith('*') \
or character.startswith('+') \
or character.startswith('-') \
:
pass
else:
beforeReplace = headerSpace
headerSpace = headerSpace + " "
break
headerSpace += character
if spaceFlag == False:
line= line.replace(beforeReplace,headerSpace)
return line
class CreateTabTextClass:
def __init__(self) -> None:
self.codeFlag=False
self.codeHeadTab=""
self.tableFlag=False
def CreateTabText( \
self \
,eachLine \
,checkTabSharpClass \
):
tabCharacter=""
returnEachLine=""
returnEachLine=eachLine
if checkTabSharpClass.sharpAsteriskFlag==False \
and checkTabSharpClass.tableFlag==False:
tabCharacter="\t"
self.codeHeadTab=""
if eachLine.startswith(" "):
if self.codeFlag == False:
self.codeHeadTab = tabCharacter + checkTa...
returnEachLine = self.codeHeadTab + tabCharac...
self.codeFlag=True
elif eachLine.startswith(' ')==False \
and self.codeFlag==True :
returnEachLine = self.codeHeadTab + tabCharac...
self.codeFlag=False
if eachLine.replace("\t","").startswith("|"):
tableSeparate="|"
if self.tableFlag==False:
for pipeCount in range(1, eachLine.count(...
tableSeparate+="-|"
returnEachLine= tabCharacter + checkTabSh...
+ tabCharacter + che...
self.tableFlag=True
else:
returnEachLine= tabCharacter + checkTabSh...
elif self.tableFlag==True \
and eachLine.replace("\t","").startswith(...
:
self.tableFlag=False
return returnEachLine
class ConvertImgrClass:
def convert(self, argEachLine):
eachLine=argEachLine
afterSplitComma=[]
afterSplitSlash=[]
imgFileName=""
afterSplitComma=eachLine.split(",")
afterSplitSlash=afterSplitComma[0].split("/")
imgFileName=afterSplitSlash[-1].lower()
eachLine=":
try:
checkTabSharpClass = CheckTabSharpClass()
createTabTextClass = CreateTabTextClass()
convertImgrClass = ConvertImgrClass()
eachLine=""
outputText=""
for line in inputLines:
eachLine=line
if \
eachLine.startswith('*') \
or eachLine.startswith('+') \
or eachLine.startswith('-') \
or eachLine.startswith('|') \
:
#Spaceが無い場合に追加
if eachLine.startswith('|')==False:
eachLine = checkAddSpace(eachLine)
#Tabと * の処理
eachLine = checkTabSharpClass.check(e...
eachLine=re.sub(r" \[.........\]", ""...
eachLine=re.sub(r"\[.........\]", "",...
eachLine=createTabTextClass.CreateTabText...
e...
,...
...
if "&imgr" in eachLine:
eachLine=convertImgrClass.convert(eac...
eachLine=eachLine.replace("~","")
eachLine=eachLine.replace("[[","[")
eachLine=eachLine.replace(":http","](http")
eachLine=eachLine.replace("]]",")")
eachLine=eachLine.replace("''","**")
eachLine=eachLine.replace("&br;","<br>")
eachLine=eachLine.replace("|h","|")
outputText+=eachLine
del createTabTextClass
del checkTabSharpClass
del convertImgrClass
return outputText
except:
import traceback
traceback.print_exc()
* ファイル単位で処理する場合 [#p957c8bf]
inputFileName="input.pukiwiki"
outputFileName="output.wikijs"
with open('pukiwikiWikijsSource\\'+inputFileName, 'r', en...
open('pukiwikiWikijsSource\\'+outputFileName, 'w', e...
transFormLineClass = TransFormLineClass()
inputLines=[]
for line in infile:
inputLines.append(line)
outputText=""
outputText=transFormLineClass.transform_line(inputLin...
if outputText is not None and isinstance(outputText, ...
outfile.write(outputText)
del transFormLineClass
```
+ PlantUML,シーケンス図
+
```
@startuml sequence
title pukiwiki -> wiki.js 変換プログラム
participant main
participant TransFormLineClass
participant CheckTabSharpClass
participant CreateTabTextClass
Activate main
note right main
inputFileName="input.pukiwiki"
outputFileName="output.wikijs"
open input.pukiwiki
open output.wikijs
end note
loop foreach line in input file
note right main
inputLines.append(line)
end note
end
note right main
outputText=transFormLineClass.transform_line(inputLines)
end note
main -> TransFormLineClass: transform_line(self, input...
Activate TransFormLineClass
note right TransFormLineClass
checkTabSharpClass = CheckTabSharpClass()
createTabTextClass = CreateTabTextClass()
eachLine=""
outputText=""
end note
TransFormLineClass -> CheckTabSharpClass
activate CheckTabSharpClass
TransFormLineClass -> CreateTabTextClass
activate CreateTabTextClass
loop foreach line in inputLines
note right TransFormLineClass
eachLine = line
end note
alt eachLine.startswith('*') or eachLine.startswith('...
alt eachLine.startswith('|')==False
TransFormLineClass -> main: checkAddSpace
note right TransFormLineClass
+ # - のあとに半角スペースが無ければ挿入
end note
activate main
main --> TransFormLineClass: eachLine
deactivate main
end
TransFormLineClass -> CheckTabSharpClass: check(each...
note right CheckTabSharpClass
afterReplaceCharacter=""
beforeReplaceCharacter=""
end note
alt line and line[0] in {"+", "-"}
note right CheckTabSharpClass
+ を + へ変更
beforeReplaceOrderList = ""
orderCount=0
newListLine=""
end note
loop characterOrder in line
alt characterOrder==" "
note right CheckTabSharpClass
何文字目かの文字(foreach)が、半角スペース(もう終...
break
end note
else
alt orderCount==0
note right CheckTabSharpClass
文字が - か + で、かつ最初の文字の時
beforeReplaceOrderList = characterOrder
newListLine = characterOrder.replace(beforeRepl...
end note
else
note right CheckTabSharpClass
文字が - か + で、かつ2文字目以降(タブの追加)
beforeReplaceOrderList += characterOrder
newListLine = "\ t" + newListLine
self.tabCharacter += "\ t"
end note
end
end
note right CheckTabSharpClass
orderCount += 1
end note
end
note right CheckTabSharpClass
line = line.replace(beforeReplaceOrderList,newList...
end note
end
alt line and line[0]=="|"
note right CheckTabSharpClass
self.tableFlag=True
end note
else
note right CheckTabSharpClass
self.tableFlag=False
end note
end
alt line and line[0]=="*"
note right CheckTabSharpClass
line = line.replace("*","#")
self.tabCharacter=""
self.sharpAsteriskFlag=True
end note
else self.tableFlag==False
note right CheckTabSharpClass
self.sharpAsteriskFlag=False
end note
end
CheckTabSharpClass --> TransFormLineClass: eachLine=...
note right TransFormLineClass
ハッシュタグの消去
end note
end
TransFormLineClass -> CreateTabTextClass:createTabTex...
note right CreateTabTextClass
tabCharacter=""
returnEachLine=""
returnEachLine=eachLine
end note
alt checkTabSharpClass.sharpAsteriskFlag==False
note right CreateTabTextClass
tabCharacter="\ t"
end note
end
alt checkTabSharpClass.tableFlag==False
note right CreateTabTextClass
tabCharacter="\ t"
end note
end
alt self.eachLine.startswith(" "):
alt self.codeFlag == False
note right CreateTabTextClass
self.codeHeadTab = tabCharacter + "```\n"
end note
end
note right CreateTabTextClass
returnEachLine = self.codeHeadTab + tabCharacter + ...
self.codeFlag=True
end note
else self.eachLine.startswith(' ')==False and self.co...
note right CreateTabTextClass
returnEachLine = tabCharacter + "```\n" + eachLine
self.codeFlag=False
end note
end
alt eachLine.replace("\ t","").startswith("|")
note right CreateTabTextClass
tableSeparate="|"
end note
alt eachLine.replace("\t","").startswith("|")
note right CreateTabTextClass
tableSeparate="|"
end note
loop pipeCount in range(1, eachLine.count("|"))
note right CreateTabTextClass
tableSeparate+="-|"
end note
end
note right CreateTabTextClass
returnEachLine= tabCharacter + checkTabSharpClass....
+ tabCharacter + checkTabSharpClass.tabCharac...
self.tableFlag=True
end note
else
note right CreateTabTextClass
returnEachLine= tabCharacter + checkTabSharpClass....
end note
end
else self.tableFlag==True and eachLine.replace("\t","...
note right CreateTabTextClass
self.tableFlag=False
end note
end
CreateTabTextClass --> TransFormLineClass:returnEachL...
note right TransFormLineClass
eachLine=eachLine.replace("~","")
eachLine=eachLine.replace("[[","[")
eachLine=eachLine.replace(":http","](http")
eachLine=eachLine.replace("]]",")")
eachLine=eachLine.replace("''","**")
outputText+=eachLine
end note
end
TransFormLineClass --> main: outputText ...
deActivate CreateTabTextClass
deActivate CheckTabSharpClass
deActivate TransFormLineClass
note right main
outfile.write(outputText)
end note
@enduml
```
+  なぜか vim をインストール後、かつsshの状態で、...
- とりあえず、<kbd>Shift</kbd> + <kbd>Insert</kbd>で緊急...
- あとはバックスペースが効かないとか。。。一応、以下にま...
- [vi,vim(wiki.js)](https://wikijs.tar3.net:3443/ja/310-...
* コメントをフルオープンにした場合、どれくらいスパムが来...
- 2025/6/20 7:15~
- そのうち結果を書きます
- 2025/6/30(18:00):今のところスパムは無いです。このまま...
* upgrade [#j1a2f611]
-[[公式ページリンク:https://docs.requarks.io/install/upgr...
- Run to need by super user.
+ Stop the running Wiki.js instance
systemctl stop wikijs
+ Make a backup of your config.yml file.
cp wiki/config.yml ~/config.yml.bak
+ Change folder name
mv wikijs wikijsBak
+ create directory
mkdir wikijs
cd wikijs
+ Download the latest version of Wiki.js.
wget https://github.com/Requarks/wiki/releases/latest/do...
+ Extract the package
tar xzfv wiki-js.tar.gz
+ If created the link of data directory
rm -fr data
ln -s /mnt/target/directory data
+ Restore your config.yml back to its original location.
cp ~/config.yml.bak ./config.yml
+ start wiki.js
systemctl start wikijs
+ If no problem, delete the backup folder.
rm -fr ../wikijsBak
ページ名: