基于gollum的wiki搭建

给你一囗甜甜゛ 提交于 2020-03-05 15:12:07

基于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
Option Arguments Description
--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
--bare none Tell 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.
--css none Tell Gollum to inject custom CSS into each page. Uses custom.css from repository root
--js none Tell Gollum to inject custom JS into each page. Uses custom.js from repository root
--emoji none Parse and interpret emoji tags (e.g. :heart:).
--no-edit none Disable the feature of editing pages.
--live-preview none Enable the live preview feature in page editor.
--no-live-preview none Disable 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
--mathjax none Enables MathJax (renders mathematical equations). By default, uses the TeX-AMS-MML_HTMLorMML config with the autoload-all extension
--irb none Launch Gollum in "console mode", with a predefined API.
--h1-title none Tell Gollum to use the first <h1> as page title.
--show-all none Tell Gollum to also show files in the file view. By default, only valid pages are shown.
--collapse-tree none Tell 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.
--help none Display the list of options on the command line.
--version none Display 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的自动发布;
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!