This commit is contained in:
ohbarye
2015-05-03 23:33:23 +09:00
parent f85a63ba06
commit 718582426d
6 changed files with 109 additions and 54 deletions
View File
-50
View File
@@ -1,50 +0,0 @@
# What is 'markdown-server' ?
MarkdownをHTML化して`text/html`形式でレスポンスするシンプルなWebアプリケーションです。Markdown Engineは**Github flavored Markdown**です。
## How to use
### Runtime Environment
python実行環境が必要です。
### Library Dependencies
`packages_requirements.txt`を参照してください。
主に下記ライブラリに依存しています。
|No.|Name|Description|
|:---|:---|:---|
|1|markdown|Markdown -> HTML 変換ライブラリ|
|2|pygments|シンタックスハイライト用|
|3|bottle|Webアプリケーションフレームワーク|
### Just try
サーバを起動して実行結果を確認する為に、特別な準備は何も必要ありません。
下記コマンドを実行するだけでサーバが起動します。
```
$ git clone https://github.com/ohbarye/markdown-server
$ cd markdown-server
$ pip install -r packages_requirements.txt
$ python start_server.py
```
サーバが起動したら下記アドレスにアクセスし、サンプルMarkdownファイルの変換結果を確認してみてください。
```
$ open http://localhost:8009/sample.md
```
### Do as you like
* markdown-server は`resources/markdown`ディレクトリに配置されたMarkdownファイルに対し、`http://host/[file_name]`の形式でルーティングを提供します。任意のファイルを置いてください。
* 変換されたファイルは`resources/html`ディレクトリに配置されます。生成されるHTMLファイルにCSSも組み込まれているので配布も容易です。
* ホスト名やポート番号などの環境変数は`env.py`にまとめています。適宜変更してください。
```python
ms_port = '8009'
ms_host = 'localhost'
```
* デフォルトの Markdown Engine は**Github flavored Markdown**です。異なるスタイルを適用したい場合は好みに応じてCSSファイルを差し替え、`env.py`を編集してください。
```python
css_name = 'github.css'
markdown_type = 'gfm'
```
+70
View File
@@ -0,0 +1,70 @@
===============
Markdown Server
===============
Markdown-server is a simple web application.
It converts markdown file to HTML and response by `text/html`.
How to use
==========
--------------------
Runtime Environment
--------------------
:Python: 2.7.9
:pip: 6.1.1
:virtualenv: 12.1.1
--------------------
Library Dependencies
--------------------
See `requirements.txt`.
--------------------
Just try
--------------------
You don't need any special preparation to try to start server. Just execute below comands.
::
$ git clone https://github.com/ohbarye/markdown-server
$ cd markdown-server
$ virtualenv .venv
$ source .venv/bin/activate
(.venv)$ pip install -r requirements.txt
(.venv)$ mdsvr
Bottle v0.12.8 server starting up (using WSGIRefServer())...
Listening on http://localhost:8009/
If server start up successfully, browse below URL and check the converted result.
::
$ open http://localhost:8009/sample.md
--------------
Do as you like
--------------
- Markdown server purvey `http://host/[file_name]` URL. This corresponds to `resources/markdown/[file_name]`.You can put any markdown file here.
- Converted file will be placed to `resources/html` directory. Generated html file includes CSS so it's ease to distribute.
- Environment variables like *host name* or *port number* are set in `env.py`. Edit arbitrarily.
::
ms_port = '8009'
ms_host = 'localhost'
- The default markdown engine is Github flavored Markdown. If you want to use another style, add CSS and edit `env.py`.
::
css_name = 'github.css'
markdown_type = 'gfm'
+9
View File
@@ -0,0 +1,9 @@
bottle==0.12.8
linecache2==1.0.0
Markdown==2.6.2
-e git+https://github.com/ohbarye/markdown-server@f85a63ba06ca7cb5beb59bd96153d7ba1fa867ae#egg=markdownserver-master
py-gfm==0.1.0
Pygments==2.0.2
six==1.9.0
traceback2==1.4.0
unittest2==1.0.1
+3
View File
@@ -0,0 +1,3 @@
[aliases]
release = register sdist bdist_wheel upload
+27 -4
View File
@@ -1,19 +1,42 @@
import os
from setuptools import setup, find_packages from setuptools import setup, find_packages
def read_file(filename):
basepath = os.path.dirname(os.path.dirname(__file__))
filepath = os.path.join(basepath, filename)
if os.path.exists(filepath):
return open(filepath).read()
else:
return ''
setup( setup(
name = 'markdownserver', name = 'markdown-server',
version = '0.1.0', version = '0.1.0',
description = 'A simple markdown server.',
long_description = read_file('README.rst'),
author = 'Masato Ohba',
author_email = 'over.rye@gmail.com',
url = 'https://github.com/ohbarye/markdown-server',
classifiers = [
'Topic :: Utilities',
'Development Status :: 4 - Beta',
'Framework :: Bottle',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
],
packages = find_packages(), packages = find_packages(),
include_packages_data = True, include_package_data = True,
keywords = ['web', 'markdown'],
license = 'MIT License',
install_requires = [ install_requires = [
'bottle', 'bottle',
'Markdown', 'Markdown',
'Pygments', 'Pygments',
'py-gfm', 'py-gfm',
], ],
entry_points = """ entry_points = """
[console_scripts] [console_scripts]
markdownserver = markdownserver:main mdsvr = markdownserver:main
""", """,
) )