首页  编辑  

Redmine wiki中标题增加编号功能

Tags: /计算机文档/软件应用技巧/   Date Created:
Redmine wiki当中,有h1, h2, h3等head标题功能,如何给这些标题自动增加编号功能?类似word里面的多级项目符号编号?

1. 首先,去 http://projects.andriylesyuk.com/project/redmine/wiking 下载wiking扩展,安装到Redmine的plugin目录。
2. 在redmine目录下,运行bundle exec rake redmine:plugins:migrate RAILS_ENV=production
3. 重启Redmine
4. 在Redmine管理当中,会有Custom wiki macros功能,进入后,添加一个macro,名字为headernumbers,描述为:
为标题增加编号功能,例如h1, h2, h3增加编号列表功能
使用方法,在需要用到的页面中使用 {{headernumbers}} 宏
h1 必须存在,最多支持到h6
内容为:
<style type="text/css"> 
div.wiki, div.wiki-page {
  counter-reset:h1s;
}

.wiki h1 {
    counter-reset: h2s;
}
.wiki h1::before {
    content: counter(h1s) ". ";
    counter-increment: h1s;
}
.wiki h2 {
   counter-reset: h3s;
}
.wiki h2::before {
    content: counter(h1s) "." counter(h2s) ". ";
    counter-increment: h2s;
}
.wiki h3 {
   counter-reset: h4s;
}
.wiki h3::before {
    content: counter(h1s) "." counter(h2s) "." counter(h3s) ". ";
    counter-increment: h3s;
}
.wiki h4 {
    counter-reset: h5s;
}
.wiki h4::before {
    content: counter(h1s) "." counter(h2s) "." counter(h3s) "." counter(h4s);
    counter-increment: h4s;
}
.wiki h5 {
}
.wiki h5::before {
    content: counter(h1s) "." counter(h2s) "." counter(h3s) "."  counter(h4s) "." counter(h5s);
    counter-increment: h5s;
}
</style>
5. 在需要用到的wiki页面,使用{{headernumbers}}即可给页面增加自动编号功能。