nkc community project, version 2. currently under dev.
在nkc_render.js中,markdown 被 commonmark parse 成 html之后,经过若干正则表达式,得到最终输出。 例如,\[r=123\]表示图片附件,编号123。会被渲染成一张图片。但是目前加载此资源未必返回图片(如果资源是rar一样会response),应在服务端加入mime类型检查。 又例如,\[rt=123\]\[filename.ext/\]表示点击下载附件,编号123。会被渲染成 缩略图+文件名的形式。适合插入文章内部。 现在尚缺几种新的标记,例如[audio=123] [video=123]等等。它们应该被渲染成合适的播放器。 另外这些标记和现有markdown有冲突,应参考discourse项目解决方案。 另外,也需要引入诸如[smiles=331/],以及$$latex-code$$这样的标签。总而言之,还有很多工作要做。
You are allowed to use these files for any purpose, as long as you admit that they are useful. The author of these files shall not be held responsible for any terrorist attacks or global climate changes caused by the use of these files.
- serves static files
- render then serve .jade files
- ...if paths are properly routed with express
- exposes RESTful APIs
- document storage and query using ArangoDB
- uses socket.io for real-time notifications
- upload and download of attachments
- manipulate the images uploaded for various uses
- Install Node.js, ImageMagick for your system and make sure
npm
andconvert
is available as a command from CLI. git clone
this project, or extract from zip, to somewhere nicenpm update
there for the dependencies- Make sure ArangoDB is listening on localhost:8529, then run db_restore.command from Finder (OS X: may need
chmod +x
first) orsh db_restore.command
(UNIX) to load the database from JSON files - run run_as_dev.bat or run_as_dev.command to start the server in a CLI environment
- Press Enter in terminal window whenever to restart server. You may also visit
server:port/reload
to do the same
- 为你的操作系统安装Node.js 和 ImageMagick,并确保
npm
与convert
命令在命令行中可用 - 通过
git clone
或者zip解压将本项目弄到某处 - 在该处
npm update
以获取依赖项 - 确保 ArangoDB 在 localhost:8529 监听, 然后从Finder运行 db_restore.command (OS X: 可能需要先
chmod +x
) 或者sh db_restore.command
(UNIX) 以将JSON文件载入数据库 - 运行 run_as_dev.bat or run_as_dev.command 以从命令行启动服务器
- 在命令行窗口中随时按下 Enter 就可以重启服务器。 你也可以访问
server:port/reload
实现同样效果
/scripts
contains various scripts to accelerate deployment- by default listens on localhost:1086
server_settings.js
includes several globally used server parameters and static serving routes and URL rewrites- GET
server:port/html/jade/somename
will respond with rendered/nkc_modules/jade/somename.jade
- Every unrouted path will end up returning 404.jade
markdown
,bbcode
andplain
is available as filters when rendering .jade files usingrequire('jaderender')(filename,options)
.query_functions.js
is the database wrapperapi_functions.js
contains all the API functions. They are called before serving API/HTML requestswhatever_handlers.js
contains route endpoints, in the form of Express middlewaresim_functions.js
contains wrapper for ImageMagick binaries.