Coder Social home page Coder Social logo

nico-cmd's Introduction

Theme for CMD modules Documentation


这是一个为 spmjs.org 中模块的静态文档设计的 nico 主题。

安装

1. 安装 node

请自己安装 node。

2. 安装 nico

参考 http://lab.lepture.com/nico/zh/

另外,如果你安装了 socket.io 的话,将有 livereload 功能。

$ npm install socket.io -g

3. 安装 CMD theme

Linux & Mac 用户一键安装:

curl https://raw.github.com/spmjs/nico-cmd/master/bootstrap.sh | sh

Windows 用户安装:

1.切换到.spm目录

2.创建一个themes的目录并切换进入

3.从 git 上拉一份 cmd 的 theme

4.重命名nico-cmd目录为cmd

P.S. 注意千万别把C:\Users\{{username}}\.spm\themes\cmd目录设置为全局PATH,这样nico命令会失效,切记!

cd C:\Users\{{username}}\.spm

mkdir themes
cd themes

git clone https://github.com/spmjs/nico-cmd.git

rename nico-cmd cmd

cd cmd

使用说明

使用 spm-doc 来管理模块文档。

文档编辑

nico 还会用到模块根目录下的 package.json 文件,具体项的含义请参考:spm package.json

其中 repository.url 用来生成 View the Project 链接, bugs.url 用来生成讨论链接。

特有功能

用三个 ` 会高亮显示代码

```js
function something() {
}
```

用四个 ` 会高亮显示代码,还会将代码插入到生成的 HTML 页面中

````js
function something() {
}
````

````html
<div class="content"></div>
````

插入 iframe

````iframe
<link rel="stylesheet" href="css/some.css">
<button>click</button>
<script>
    seajs.use('jquery', function($) {
        $('button').click(function() { alert('hello'); })
    });
</script>
````

还可以设置 iframe 的高度

````iframe:400
````

生成 iframe 的模板是 templates/iframe.html,不用写头写尾。

输出

假设模块的目录结构为(以下结构可以用 spm init 插件 来生成):

package.json
src/
    hello-world.js
examples/
    hello-world.md
docs/
    hello-world.md
README.md

执行 spm doc build 后会生成:

package.json
_site/
    index.html
    src/
        hello-world.js
    examples/
        hello-world.html
    docs/
        hello-world.html
src/
    hello-world.js
examples/
    hello-world.md
docs/
    hello-world.md
README.md

所有生成的文件都在 _site 目录下。

测试

使用 spm test 命令就可以直接在命令行里运行用例。依赖 spm doc

当然也可以使用 spm doc watch 启动服务,然后访问 http://127.0.0.1:8000/tests/runner.html 用例页面进行测试。

nico-cmd's People

Contributors

afc163 avatar lepture avatar popomore avatar lizzie avatar hotoo avatar sorrycc avatar lifesinger avatar

Watchers

James Cloos avatar mountain avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.