You are not logged in.
Hi,
I just wanted to announce my new project: kokoi.
kokoi watches for changes on the markup files (Markdown, Textile, reStructuredText...) in the directory kokoi is started, and if they change, automatically reprocesses and previews them directly in the browser. You will work on your files without having to leave your favorite text editor!
The rendered HTML is optionally saved. kokoi is the perfect tool for those who like to keep notes in markup-formatted files and who are always editing them.
You can also pass, as arguments, multiple markup files, or directories, which will be scanned recursively.
Additional features are, configurable command to process markup files, support for math formulas (rendered with MathJax), and support for custom HTML templates.
Note: the PKGBUILD includes 'markdown' in the dependencies, if you also need math formulas support, you should use a markup converter such as pandoc, which supports them.
I hope you like it, I'd like to hear your comments.
Offline
Update: v0.1.4.
...actually, it is my first PKGBUILD, considering the (numerous ) comments, I'm starting to think it doesn't work...
Offline
I was trying this out for a while to compare the workflow with how I'd write notes in mikidown, but I couldn't exactly figure out how to look at the rendered html with kokoi without saving the html output.
After looking at this file ( https://github.com/zeis/kokoi/blob/master/lib/kokoi.js ), I tried to see if I could make it make use of the python markdown module by writing a short script:
import markdown
import sys
extensions=['extra', 'nl2br', 'strkundr', 'toc'] #replace this with your own
md = markdown.Markdown(extensions)
try:
fname=sys.argv[1]
except IndexError as e:
fname = None
print(md.convertFile(input=fname))
# since the file is fed to the command via STDIN. I'm not sure why you fed it to the markdown parser
# through STDIN via the "cmd < fname" bit in lib/kokoi.js
So it reads in the file just like I expect, but I can't figure out if the served notes are supposed to be at localhost:port/Fname-with-no-ext or localhost:port/Fname.html or localhost:port/Fname.md .
Trying the first two options results in a "Not Found" while the last option results in a blank page.
For every problem, there is a solution that is:
Clean
Simple and most of all...wrong!
Github page
Offline
The html output is sent to the client via WebSockets, afterwards only the content of the index page is updated. In the case you only need to preview the files, saving the html output and serving it statically would result in diminished performance, so, actually you will never "see" the real html page (unless you use the --save option).
Anyway, your python script is interesting, thank you for pointing out this thing about the STDIN. I simplified the command of the exec callback function, now, in version v0.1.5, you should be able to convert markdown files using simpler python scripts like this:
#!/usr/bin/env python
import markdown
import sys
fname = sys.argv[1]
input_file = open(fname, mode="r")
text = input_file.read()
html = markdown.markdown(text)
print(html)
To update kokoi, just run as root:
npm uninstall -g kokoi
npm install -g kokoi
Let me know.
Last edited by zeis (2014-01-07 22:18:37)
Offline
Updated the the more recent kokoi version and made a miscellaneous change to a file in my notes directory to test both the script and kokoi. It works ! Now just to test how my note taking experience will change using kokoi and some text editor of my choice based on how often I take notes.
For every problem, there is a solution that is:
Clean
Simple and most of all...wrong!
Github page
Offline