DokuWiki之2025升级

DokuWiki之2025升级

使用DokuWiki已经超过了10年,非常喜欢它的简洁易用,轻量快速且不需要数据库。时间来到了2025年,随着Markdown的流行,我想升级一下DokuWiki,再尝试体验一下新的插件,特此记录。

下载安装

运行环境

php-fpm或frankenphp都可以,php-fpm需要nginx的配合,基于golang的frankenPHP直接可以运行。

FrankenPHP 是建立在 Caddy Web 服务器之上的现代 PHP 应用程序服务器。

FrankenPHP 凭借其令人惊叹的功能为您的 PHP 应用程序提供了超能力:早期提示、worker 模式、实时功能、自动 HTTPS、HTTP/2 和 HTTP/3 支持……

FrankenPHP 可与任何 PHP 应用程序一起使用,并且由于提供了与 worker 模式的集成,使您的 Symfony 和 Laravel 项目比以往任何时候都更快。

调整一下/etc/frankenphp/php.ini ,更多参数详见 FrankenPHP配置

[PHP]
memory_limit = 256M
max_execution_time = 120
display_errors = Off
 
zend_extension=opcache
opcache.enable=1
 
upload_max_filesize = 64M
post_max_size = 64M
 
zlib.output_compression = On
zlib.output_compression_level = 5
 
realpath_cache_size = 16M
realpath_cache_ttl = 120
 
session.save_handler = files
session.save_path = /tmp
session.cache_limiter = public
session.cache_expire = 180

运行:

frankenphp php-server -r dokuwiki --listen :8080

插件管理

风格管理

自定义风格

修改样式表

./lib/plugins/note/style.css → .plugin_note

.plugin_note {
  margin: 2em auto;
  max-width: 83%;
  min-height: 40px;
  text-align: justify;
  vertical-align: middle;
  border-collapse: collapse;
  padding: 15px 20px 15px 80px;
  background-position: 12px 100%;
  background-repeat: no-repeat;
  -moz-border-radius: 20px;
  -khtml-border-radius: 20px;
  border-radius: 20px;
  color: black;
  overflow: hidden;
}

./lib/styles/all.css →

h2 {
  color: #ffffff !important;
  background-color: #83b5aa;
  border-left: 10px solid #5c726e;
  padding : 1px 1px 1px 15px;
}
 
h3 {
  border-left: 20px solid #5c8eee;
  padding : 1px 1px 1px 20px;
} 
 
h3:hover {
  background-color: pink;
  transition: background-color 3s;
}   
 
h4 {
  font-style: italic;
} 

blockquote → style.css

禁用此特效,否则会影响深色模式的字体显示

padding: 0em 0.2em 0em 0.5em; /* 顺序:上 右 下 左 */
//background: __background_alt__; 

增加全局背景图

利用浏览器F12开发者工具,找出mikio.less里的class,添加代码:

.mikio .mode_admin table {
    width: 75%;
 
.mikio-content {    
...
  background-image:url(/background.png) !important;
} 
 
    .mikio-nav-item,
    .mikio-nav-dropdown,
    > button, > span {
        display: inline-block;
        padding: .5rem .2rem;
        margin: 0 .5rem;
        font-size: 1rem;
 
// patch by shaohy        
    /* 弹性文字处理 */
    white-space: nowrap;
    flex-shrink: 0;
    min-width: max-content;
 
    /* 多层阴影效果 */
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.1),
        0 4px 6px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
        border-radius: 6px;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }       
 
.mikio-nav-item:hover,
.mikio-nav-dropdown:hover,
> button:hover, > span:hover {
    box-shadow: 0 4px 12px rgba(0, 255, 0, 0.6);
    transform: translateY(-1px); /* 轻微上浮 */
    transition: all 0.5s ease;
}
 
 
pre,
code,
samp,
kbd {
    font-family: Consolas, "Andale Mono WT", "Andale Mono", "Bitstream Vera Sans Mono", "Nimbus Mono L", Monaco, "Courier New", monospace;
        /* same font stack should be used for ".dokuwiki table.diff td" in _diff.css */
    font-size: 1em;
    direction: ltr;
    text-align: left;
 
    //background-color: #ffd700;
    //background-color: #ffc0cb;
    box-shadow: 0 0 .2em @ini_border inset;
    border:0px solid #000;
    box-shadow: 0 0 .2em @ini_border inset;
    border-radius: 8px;
 
    /* 智能换行设置 */
    white-space: pre-wrap;       /* 保留空白符但允许换行 */
    word-break: normal;         /* 正常的单词断行 */
    overflow-wrap: anywhere;    /* 在任意位置换行 */
    hyphens: auto;              /* 自动连字符(可选) */
}

添加导航条

/lib/tpl/mikio/mikio.php

$myMenuBar="wiki|知识库;blog|博客;autoarchive|归档;about|我";
$html .= $this->stringToNav($myMenuBar);

DokuWiki

DokuWiki is a simple to use and highly versatile Open Source wiki software that doesn't require a database. It is loved by users for its clean and readable 格式化语法. The ease of maintenance, backup and integration makes it an administrator's favorite. Built in access controls and authentication connectors make DokuWiki especially useful in the enterprise context and the large number of plugins contributed by its vibrant community allow for a broad range of use cases beyond a traditional wiki.

Read the DokuWiki Manual to unleash the full power of DokuWiki.

Download

DokuWiki is available at https://download.dokuwiki.org/

Read More

2004-2020 © Andreas Gohr andi@splitbrain.org1) and the DokuWiki Community

The DokuWiki engine is licensed under GNU General Public License Version 2. If you use DokuWiki in your company, consider donating a few bucks ;-).

Not sure what this means? See the FAQ on the Licenses.

1)
Please do not contact me for help and support – use the mailinglist or forum instead
wiki/welcome.txt · 最后更改: 2025/10/31 16:20