基於gollum的wiki搭建

基於gollum的wiki搭建

gollum是個啥

gollum是一個基於git的,解析markdown文件的wiki系統;gollum項目託管在github上:gollumhttps://github.com/gollum/gollum),項目的wiki地址:https://github.com/gollum/gollum/wiki github的wiki聽說也是基於gollum搭建的;沒確認;css

搭建

gollum是基於ruby編寫的;因此在安裝gollum以前,須要先安裝ruby環境;git

  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. 安裝gollumgithub

gem install gollum

中文目錄/文件名問題解決 注意:建議安裝 Rugged;這個是gollum所須要的git adapter ;默認的git adapter 是grit;但實際在用這個適配器的時候,會發現這個適配器不支持中文文件名、目錄的問題;使用 rugged是沒有問題的;web

  1. 安裝Rugged
gem install gollum-rugged_adapter
  1. 在啓動的時候,加上參數:
--adapter rugged

啓動

gollum是與git配合使用的,因此gollum的命令也要在git目錄下才能啓動;ruby

  • 命令以下
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的自動發佈;
相關文章
相關標籤/搜索