conis / Purelog

一个基于文件型Markdown的轻型博客系统
http://Purelog.org/
GNU General Public License v2.0
59 stars 12 forks source link

不支持插入html code? #13

Closed luckypoem closed 10 years ago

luckypoem commented 10 years ago

hi. http://as3.brite.biz:13111/archive/smiling-face.html,新建帖子时,不是默认为html editor模式吗? 如何解决?

conis commented 10 years ago

目前只支持markdown,不支持html哦

luckypoem commented 10 years ago

hi. 那我如何嵌入音频/视频呢?

luckypoem commented 10 years ago

hi. 再者,markdown格式不是默认就是html editor模式吗?怎么在你这个程序里嵌入html code却失败呢?

conis commented 10 years ago

和markdown的解析引擎有关,我还真没有试过,因为我自己还没有插入html的需求,包括音频啥的。 目前是用到这个markdown的解析引擎:https://github.com/evilstreak/markdown-js

On 28 Mar, 2014, at 7:15 pm, luckypoem notifications@github.com wrote:

hi. 再者,markdown格式不是默认就是html editor模式吗?怎么在你这个程序里嵌入html code却失败呢?

— Reply to this email directly or view it on GitHub.

luckypoem commented 10 years ago

hi. as3:~/purelog-site# ls app.js config.js content node_modules package.json as3:~/purelog-site#

怎么没看到静态网站的根目录?这样,如何绑定域名呢?

conis commented 10 years ago

绑定域名需要用nginx做反向代理,静态目录默认在content中,config.js文件可以设置不同的目录

On 1 Apr, 2014, at 3:38 pm, luckypoem notifications@github.com wrote:

hi. as3:~/purelog-site# ls app.js config.js content node_modules package.json as3:~/purelog-site#

怎么没看到静态网站的根目录?这样,如何绑定域名呢?

— Reply to this email directly or view it on GitHub.

luckypoem commented 10 years ago

hi. 你好。可否研究一下如何才能成功的嵌入html code(比如youtube代码)? 非常感谢!

conis commented 10 years ago

我找找看没有更好的Markdown解释器,如果你发现有合适的Markdown解释器,别忘记告诉我哦。

On 4 Apr, 2014, at 10:04 am, luckypoem notifications@github.com wrote:

hi. 你好。可否研究一下如何才能成功的嵌入html code(比如youtube代码)? 非常感谢!

— Reply to this email directly or view it on GitHub.

luckypoem commented 10 years ago

hi. 发现一个Markdown解释器:marked,不过我不敢马上运行npm install marked,怕跟markdown-js有冲突,如何先卸载markdown-js? as3:~/purelog-site# ls node_modules express purelog-router-rss purelog-storage-local purelog purelog-storage-dropbox purelog-theme-ghost purelog-reduce-cache purelog-storage-git purelog-theme-hyde as3:~/purelog-site# 我没发现markdown-js模块,怎么回事?

conis commented 10 years ago

这个似乎不错,你确定能满足你的需求吗。 markdown的引用实际上在yousite/node_modules/purelog/node_modules,因为你使用purelog init命令安装purelog,实际会有一个purelog的包被安装了,而markdown就在purelog下。 你可以cd到yousite/node_modules/purelog,使用npm install marked,然后你需要改动一下。 这个文件在:yoursite/node_modules/purelog/lib/storage.js,对应github上是:https://github.com/conis/Purelog/blob/master/purelog/purelog-core/lib/storage.js 第5行是引入markdown解释器,代码是:, _markdown = require('markdown').markdown;,第36行是解释markdown,具体的代码是article.content = _markdown.toHTML(article.content);

呵呵,希望你更改成功哦,享受折腾的乐趣吧,也希望收到你的pull request。

On 5 Apr, 2014, at 1:20 pm, luckypoem notifications@github.com wrote:

marked

luckypoem commented 10 years ago

hi. 要改的地方太多: as3:~/purelog-site# node app.js /root/purelog-site/node_modules/purelog/lib/storage.js:37 article.content = _markdown.toHTML(article.content); ^ TypeError: Cannot call method 'toHTML' of undefined at /root/purelog-site/node_modules/purelog/lib/storage.js:37:35 at /root/purelog-site/node_modules/purelog-storage-local/index.js:52:5 at /root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:23:14 at /root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:150:5 at Array.forEach (native) at scanDirectory (/root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:129:9) at Object.exports.scan (/root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:20:3) at Object.exports.fetch (/root/purelog-site/node_modules/purelog-storage-local/index.js:43:12) at Object.exports.fetch (/root/purelog-site/node_modules/purelog/lib/storage.js:23:11) at Object. (/root/purelog-site/app.js:26:18) as3:~/purelog-site# ls app.js config.js content node_modules package.json purelog-router-rss as3:~/purelog-site# nano node_modules/purelog/lib/storage.js as3:~/purelog-site# node app.js /root/purelog-site/node_modules/purelog/lib/storage.js:37 article.content = _marked.toHTML(article.content); ^ ReferenceError: _marked is not defined at /root/purelog-site/node_modules/purelog/lib/storage.js:37:25 at /root/purelog-site/node_modules/purelog-storage-local/index.js:52:5 at /root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:23:14 at /root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:150:5 at Array.forEach (native) at scanDirectory (/root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:129:9) at Object.exports.scan (/root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:20:3) at Object.exports.fetch (/root/purelog-site/node_modules/purelog-storage-local/index.js:43:12) at Object.exports.fetch (/root/purelog-site/node_modules/purelog/lib/storage.js:23:11) at Object. (/root/purelog-site/app.js:26:18) as3:~/purelog-site#

还是你来改改吧。我不够你专业。尝试把markdown-js替换为marked, 非常感谢.

conis commented 10 years ago

第6行,替换成:, _marked = require('marked’); 第37行,替换成:article.content = _marked(article.content);

你要的功能就可以了,很容易的。下一个版本有可能会换成这个解释器

On 5 Apr, 2014, at 9:46 pm, luckypoem notifications@github.com wrote:

hi. 要改的地方太多: as3:~/purelog-site# node app.js /root/purelog-site/node_modules/purelog/lib/storage.js:37 article.content = _markdown.toHTML(article.content); ^ TypeError: Cannot call method 'toHTML' of undefined at /root/purelog-site/node_modules/purelog/lib/storage.js:37:35 at /root/purelog-site/node_modules/purelog-storage-local/index.js:52:5 at /root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:23:14 at /root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:150:5 at Array.forEach (native) at scanDirectory (/root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:129:9) at Object.exports.scan (/root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:20:3) at Object.exports.fetch (/root/purelog-site/node_modules/purelog-storage-local/index.js:43:12) at Object.exports.fetch (/root/purelog-site/node_modules/purelog/lib/storage.js:23:11) at Object. (/root/purelog-site/app.js:26:18) as3:~/purelog-site# ls app.js config.js content node_modules package.json purelog-router-rss as3:~/purelog-site# nano node_modules/purelog/lib/storage.js as3:~/purelog-site# node app.js /root/purelog-site/node_modules/purelog/lib/storage.js:37 article.content = _marked.toHTML(article.content); ^ ReferenceError: _marked is not defined at /root/purelog-site/node_modules/purelog/lib/storage.js:37:25 at /root/purelog-site/node_modules/purelog-storage-local/index.js:52:5 at /root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:23:14 at /root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:150:5 at Array.forEach (native) at scanDirectory (/root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:129:9) at Object.exports.scan (/root/purelog-site/node_modules/purelog-storage-local/node_modules/md2json/index.js:20:3) at Object.exports.fetch (/root/purelog-site/node_modules/purelog-storage-local/index.js:43:12) at Object.exports.fetch (/root/purelog-site/node_modules/purelog/lib/storage.js:23:11) at Object. (/root/purelog-site/app.js:26:18) as3:~/purelog-site#

还是你来改改吧。我不够你专业。尝试把markdown-js替换为marked, 非常感谢.

— Reply to this email directly or view it on GitHub.

luckypoem commented 10 years ago

hi. 确实ok了。谢谢