Coder Social home page Coder Social logo

nico's Introduction

nico

building status

Nico is a front-end friendly static site generator, best for web developers like you and me.


Installation

It's currently under development, and may be not stable enough, taks your own risk.

Install with npm is easy:

$ npm install nico -g

Get more information or help on the project homepage.

Ninja Channel

This is the channel for experiment, get nico in ninja channel with:

$ npm install nico@ninja -g

Contributing

Please do contributing, but before this, have a look at Contributing Guide.

nico's People

Contributors

7anshuai avatar afc163 avatar hotoo avatar lepture avatar lianqin7 avatar popomore avatar steel1990 avatar yize avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nico's Issues

Handle empty tags meta and correct documentation

I am generating tag pages with TagWriter, where two problems occurred:

  1. TagWriter throws an exception when an post has no tags meta:

    /usr/local/share/npm/lib/node_modules/nico/lib/writers/core.js:255
    var tags = item.meta.tags.split(' ');
                              ^
    

    After adding if(typeof item.meta.tags === 'undefined') return; immediately after this line, I managed to get it work without an exception.

  2. In the example in documentation, the delimiter between tags is comma (,), whereas in the source, it is actually space ( ). Which one should I obey to?

permalink_url for PostWriter is broken

I want to generate canonical url for each post but find the content_url(config.siteurl, permalink_url(post)) trick doesn't work as expected: the permalink_url always returns ./. At the same time, this technique works well in FeedWriter.

After a little debugging, I found this is caused by different ctx.writer.filepath. For writers except PostWriter, the filepath is something like . or page, while for PostWriter, it's the path where the post.md resides.

Why is it designed like this? How can I fix my problem?

用nico生成静态网页,其中有两个write运行生成页面,没有post出来?

准备:
nico.json配置文件如下

{
"source": "content",
"output": "_site",
"theme": "_themes/one",
"permalink": "{{directory}}/{{filename}}.html",
"writers": [
"nico.PostWriter",
"nico.FileWriter",
"nico.StaticWriter"
]
}

1

文件目录
2

生成的hello-world.html
3

问题:用nico生成静态网页,其中有两个write运行生成,没有post出来?
按照我截图的文件步骤,这样是对的还是有问题?

安装教程的一点问题

首页( http://lab.lepture.com/nico/zh/ ),的安装教程,貌似少了一个pagewriter,一直build不出来

{
    "source": "content",
    "output": "_site",
    "theme": "_themes/one",
    "permalink": "{{directory}}/{{filename}}.html",
    "writers": [
        "nico.PostWriter",
        "nico.FileWriter",
        "nico.StaticWriter"
    ]
}

2处代码不明白的地方

1. https://github.com/lepture/nico/blob/master/lib/sdk/file.js#L99

file.readJSON = function(filepath) {
  // use comptable rather than parse json
  log.debug('parse', file.cleanpath(filepath));
  try {
    return require(file.abspath(filepath));
  } catch (e) {
    log.warn('json', e.message);
    return null;
  }
};

这里用 require 去读取 cache 里的 json 文件。 第一次没问题,以后读到的都是缓存里的内容了。 导致 修改 md 后 _site 里的内容无法同步修改

2. https://github.com/lepture/nico/blob/master/lib/server.js#L39

var rebuild = function(socket, message) {
  if ((new Date() - lastChanged) > 1800) {
    fn();
    socket && socket.emit('reload', {message: message});
  }
  lastChanged = new Date();
};

这里的 1800ms 是个什么数字,有什么意义么?如果要做到 有修改就自动刷新页面 ,1800ms是不是太大了??

nico build

nico build后显示错误:spawn ENOENT
image

nico.json的内容为:

{
"source": "",
"output": "_site",
"theme": "_themes/one",
"permalink": "{{directory}}/{{filename}}.html",
"writers": [
"nico.PostWriter",
"nico.FileWriter",
"nico.StaticWriter"
]
}

index.md 怎么build ?

文档里有一个 index.md,但是build的时候不会生成 index.html

请问这需要什么特殊的设置吗?

如果加上 nico.ArchiveWriter 则生成的 index.html 是 Archive 页面,不是 index.md 的内容。

用nico在github page上做博客,项目主页的问题?

我是在window下操作nico生成站点,
参考了https://github.com/lepture/nico-boilerplate 中最后一步时候,有个问题
--------------------------问题---------------------------
And you can use make publish to publish your blog to GitHub now.
这里一定要用make publish 吗?我对make知道不多。
我使用nico build命令生出了_site 把这个文件项目git push到github上,这样是不是不正确的?
求指导?

Nico 对于 Markdown 语法的支持有一点问题

下面的 Markdown 内容:

我们可以想出来的办法:

1. 小节1

    test1

2. 小节2

    示例1:
    - 我是傻瓜1
    - 我是傻瓜2

    error is here!

    示例2:
    - wo shi shagua
    - wo shi shagua

经过 nico server 后, 展现的内容是这样的:

我们可以想出来的办法:

1. 小节1

    test1

2. 小节2

    示例1:
    - 我是傻瓜1
    - 我是傻瓜2

        error is here!

    示例2:
    - wo shi shagua
    - wo shi shagua

语句 error is here! 应该属于 2. 小节2 ,但是它现在属于 我是傻瓜2
不知道最新的版本是否修正了这个问题?

--watch 参数失效

版本0.1.0

nico help build,结果里并没有 --watch 的介绍

 -h, --help               output usage information
 -C --config <config>     the config file [nico.json]
 -I --source <source>     the content directory [content]
 -O --output <output>     the output directory [_site]
 --theme <theme>          the theme path
 --permalink <permalink>  permalink style of your site
 -v --verbose             show more logging
 -q --quiet               show less logging

但是make.bat 和Makefile里面都用到了 --watch,版本没发布的原因??

does nico support footnote syntax ?

It seems that nico does not support footnote syntax or I do not use it correctly, sorry for my poor markdown.
Does nico already support it or in schedule ?

windows 7 64bit watch 功能出错

D:\nico>nico server --watch

           nico: 0.4.7
           load: nico.json
           load: PostWriter
           load: FileWriter
           load: StaticWriter
           load: ArchiveWriter
            run: PostWriter
          write: 1 post
            run: FileWriter
            run: StaticWriter
           copy: _themes/one/static -> _site/static
            run: ArchiveWriter
           time: 0.223s
          watch: content
          watch: _themes/one
         server: http://127.0.0.1:8000
         rename: .subl6bb.tmp
           nico: 0.4.7
           load: nico.json
           load: PostWriter
           load: FileWriter
           load: StaticWriter
           load: ArchiveWriter
            run: PostWriter
          write: 1 post
            run: FileWriter

fs.js:684
  return binding.stat(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory 'D:\nico\content\.subl6bb.tmp'
    at Object.fs.statSync (fs.js:684:18)
    at Object.file.stat (C:\Users\H\AppData\Roaming\npm\node_modules\nico\lib\sd
k\file.js:160:13)
    at Object.file.copy (C:\Users\H\AppData\Roaming\npm\node_modules\nico\lib\sd
k\file.js:141:12)
    at C:\Users\H\AppData\Roaming\npm\node_modules\nico\lib\writers\core.js:113:
10
    at Array.forEach (native)
    at FileWriter.run (C:\Users\H\AppData\Roaming\npm\node_modules\nico\lib\writ
ers\core.js:110:22)
    at FileWriter.BaseWriter.process (C:\Users\H\AppData\Roaming\npm\node_module
s\nico\lib\writers\base.js:36:20)
    at C:\Users\H\AppData\Roaming\npm\node_modules\nico\lib\build.js:52:28
    at Array.forEach (native)
    at build (C:\Users\H\AppData\Roaming\npm\node_modules\nico\lib\build.js:51:1
1)

扩展语法支持

例如表格:

Option Default Value Description
url 请求地址
order 请求顺序,可不指定
type 从全局配置中继承 同初始化 jquery 的 ajax 时配置项
dataType 从全局配置中继承 同初始化 jquery 的 ajax 时配置项
timeout 从全局配置中继承 同初始化 jquery 的 ajax 时配置项
classPrefix 从全局配置中继承 class name 前缀,例如发送请求成功时,DOM 上会有 async-html-success

我写在文档里的都花掉了。

这个好支持吗

embed方式嵌入svg时getSVGDocument获取不到值

      var container = document.createElement('div');
      document.body.appendChild(container);

      var embed = document.createElement('embed');
      embed.src = 'black.svg';
      embed.width = 800;
      embed.height = 600;
      container.appendChild(embed);

      function load() {
        var doc = embed.getSVGDocument();
        if (!doc) {
          setTimeout(load, 200);
          console.log('loading');
        } else {
          console.log('done')
        }
      }
      load();

这段代码是使用embed方式嵌入svg文件,然后使用getSVGDocument获取svg的document。在静态页面中运行时会显示"loading,loading,done",这是正常的。

但是在arale的tests中写测试时,即放在it('test', function() {});中,然后使用nico运行时,会一直loading,而获取不到getSVGDocument

然后直接运行生成的静态文件,即_site/tests/runner.html?grep=svg%20test,发现可以正常运行。

于是判定应该是nico的server导致getSVGDocument失效,求解决

請教_share中normalRender()函數的使用場景

請教:

我在研讀 share.js這兩行代碼 時,似乎是對

````iframe:400
````

這樣的代碼進行處理(添加【+】或者【-】符號),但我並未在項目的其他代碼中找到調用normalRender()函數的代碼。

假若這部分代碼確實有用,可否指出具體的使用方法?
假若僅僅是預留接口,能否介紹解決的場景?

非常感謝~

能否生成不带后缀的文件

如 permalink 的设置为带 .html

"permalink": "{{directory}}/{{filename}}"

archive 生成的链接都是没后缀的,但是文章都是有后缀的,如 aa/bb.html。

能否生成 aa/bb/index.html

API docs

来完善一下Nico 新版的api文档,看到就写,慢慢补充:

FeedWriter is missing

I'm migrating my blog from octopress to nico. Nico is cool and it works!

As a blog, feed is an indispensable feature. However, if I add nico.FeedWriter to nico.json, the generation warns that:

load: fail to load nico.FeedWriter

and no xml is generated as a result.

I greped the latest source, only to find that FeedWriter exists in documentation, nowhere in the javascript source files.

Is FeedWriter removed? If so, for what reason? And how can I generate a feed with the latest nico?

run 'nico build' error

wusjtekiiMac:blog wusj$ nico build

       nico: 0.4.7
       load: nico.json

/usr/local/lib/node_modules/nico/lib/sdk/markdown/_share.js:34
if (language.slice(0, 6) === 'iframe') {
^
TypeError: Cannot call method 'slice' of null
at Renderer.exports.blockcode (/usr/local/lib/node_modules/nico/lib/sdk/markdown/_share.js:34:16)
at Parser.tok (/usr/local/lib/node_modules/nico/lib/sdk/markdown/_lib.js:895:23)
at Parser.parse (/usr/local/lib/node_modules/nico/lib/sdk/markdown/_lib.js:838:17)
at Function.Parser.parse as parser
at hlMarkdown (/usr/local/lib/node_modules/nico/lib/sdk/markdown/marked.js:20:13)
at Object.exports.normalRender (/usr/local/lib/node_modules/nico/lib/sdk/markdown/_share.js:71:10)
at Object.exports.render (/usr/local/lib/node_modules/nico/lib/sdk/markdown/marked.js:24:16)
at Object.exports.read (/usr/local/lib/node_modules/nico/lib/sdk/post.js:101:18)
at /usr/local/lib/node_modules/nico/lib/sdk/post.js:188:22
at /usr/local/lib/node_modules/nico/lib/sdk/file.js:82:7

  • nico.json
{
  "source": "content",
  "output": "_site",
  "theme": "_themes/one",
  "sitename": "XXX",
  "siteurl": "http://XXX.github.io",
  "permalink": "{{directory}}/{{filename}}",
  "writers": [
        "nico.PostWriter",
        "nico.PageWriter",
        "nico.FileWriter",
        "nico.StaticWriter",
        "nico.ArchiveWriter",
        "nico.YearWriter",
        "nico.TagWriter",
        "nico.DirectoryWriter",
        "nico.FeedWriter"
    ],
  "perpage": 20,
  "duoshuo": "XXX"

}

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.