基于gollum的wiki搭建

本文介绍如何基于 Gollum 搭建一个与 Git 集成的 Wiki 系统,并解决了中文目录及文件名的支持问题。Gollum 是一个用 Ruby 编写的 Markdown 解析 Wiki,需先安装 Ruby 环境及其依赖包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

基于gollum的wiki搭建

gollum是个啥

gollum是一个基于git的,解析markdown文件的wiki系统;gollum项目托管在github上:gollumhttps://github.com/gollum/gollum),项目的wiki地址:https://github.com/gollum/gollum/wiki github的wiki据说也是基于gollum搭建的;没确认;

搭建

gollum是基于ruby编写的;所以在安装gollum之前,需要先安装ruby环境;

  1. 安装依赖包 gollum依赖的包还是蛮多的,包括了ruby ,ruby-devel ,git 等等;看自己服务器的情况增加依赖包;
yum -y install ruby ruby-devel rubygems make gcc libxml2-devel libxslt-devel git libicu-devel

ruby版本建议在2.0+; git最好用最新版吧; 2. 安装gollum

gem install gollum

中文目录/文件名问题解决 注意:建议安装 Rugged;这个是gollum所需要的git adapter ;默认的git adapter 是grit;但实际在用这个适配器的时候,会发现这个适配器不支持中文文件名、目录的问题;使用 rugged是没有问题的;

  1. 安装Rugged
gem install gollum-rugged_adapter
  1. 在启动的时候,加上参数:
--adapter rugged

启动

gollum是与git配合使用的,所以gollum的命令也要在git目录下才能启动;

  • 命令如下
gollum --port 4567 --adapter rugged --no-edit --base-path /wiki
OptionArgumentsDescription
--host[HOST]Specify the hostname or IP address to listen on. Default: 0.0.0.0.1
--port[PORT]Specify the port to bind Gollum with. Default: 4567.
--config[FILE]Specify path to Gollum's configuration file.
--ref[REF]Specify the git branch to serve. Default: master.
--adapter[ADAPTER]Launch Gollum using a specific git adapter. Default: grit
--barenoneTell Gollum that the git repository should be treated as bare. This is only necessary when using the default grit adapter.
--base-path[PATH]Specify the leading portion of all Gollum URLs (path info). Setting this to /wiki will make the wiki accessible under http://localhost:4567/wiki/. Default: /.
--page-file-dir[PATH]Specify the subdirectory for all pages. If set, Gollum will only serve pages from this directory and its subdirectories. Default: repository root.
--cssnoneTell Gollum to inject custom CSS into each page. Uses custom.css from repository root
--jsnoneTell Gollum to inject custom JS into each page. Uses custom.js from repository root
--emojinoneParse and interpret emoji tags (e.g. :heart:).
--no-editnoneDisable the feature of editing pages.
--live-previewnoneEnable the live preview feature in page editor.
--no-live-previewnoneDisable the live preview feature in page editor.
--allow-uploads[MODE]Enable file uploads. If set to dir, Gollum will store all uploads in the /uploads/ directory in repository root. If set to page, Gollum will store each upload at the currently edited
--mathjaxnoneEnables MathJax (renders mathematical equations). By default, uses the TeX-AMS-MML_HTMLorMML config with the autoload-all extension
--irbnoneLaunch Gollum in "console mode", with a predefined API.
--h1-titlenoneTell Gollum to use the first <h1> as page title.
--show-allnoneTell Gollum to also show files in the file view. By default, only valid pages are shown.
--collapse-treenoneTell Gollum to collapse the file tree, when the file view is opened. By default, the tree is expanded.
--user-icons[MODE]Tell Gollum to use specific user icons for history view. Can be set to gravatar, identicon or none. Default: none.
--mathjax-config[FILE]Specify path to a custom MathJax configuration. If not specified, uses the mathjax.config.js file from repository root.
--template-dir[PATH]Specify custom mustache template directory.
--helpnoneDisplay the list of options on the command line.
--versionnoneDisplay the current version of Gollum.
  • 参数备注
  1. The 0.0.0.0 IP address allows remote access. Should you wish for Gollum to turn into a personal Wiki, use 127.0.0.1.
  2. Before using --adapter, you should probably read this first.
  3. When --css or --js is used, respective files must be committed to your git repository or you will get a 302 redirect to the create a page.
  4. Files can be uploaded simply by dragging and dropping them onto the editor's text area (this is, however exclusive to the default editor, not the live preview editor).
  5. Read the relevant Security note before using these.
  • 配置文件 When --config option is used, certain inner parts of Gollum can be customized. This is used throughout our wiki for certain user-level alterations, among which customizing supported markups will probably stand out.

使用说明

  1. 配合 gitlab webhook + jenkins(或者其它CI工具) 配合使用,在文件有push动作的时候,自动更新md文件,达到wiki的自动发布;

转载于:https://my.oschina.net/u/140938/blog/710743

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值