shyazusa / open-md Goto Github PK
View Code? Open in Web Editor NEWsinatraを用いた簡易markdown表示アプリです
License: MIT License
sinatraを用いた簡易markdown表示アプリです
License: MIT License
/hoge/fuga
や、/hoge
でアクセスしたときにそのディレクトリやファイルがなかったときにエラーが出ちゃうので、それを制御する。
markdownファイルや各種ディレクトリで溢れちゃうので……
<script src="highlight.pack.js"></script>
は
<script src="/highlight.pack.js"></script>
では?
/hoge/fuga/piyo
みたいなのが出来るようにする。
でもこれあまりいらないかも。
そこまでして管理したければ別のものを使ってみるとかしてくれんす。
主にcss
追加する
mdファイルの編集が出来るようにする。
index.md
でなくても良いのだけれど、各ディレクトリと各ファイルへのリンクを自動で作成する何かが欲しいね。
if File.exist?("md/#{filename}.md")
f = File.read("md/#{filename}.md", encoding: Encoding::UTF_8)
else
f = File.read("md/nofile.md", encoding: Encoding::UTF_8)
end
ここ処理まとめる。
後置unless
でfilename
変えればイケる?
markdownが質素?な感じがするので、何かcssを入れたい
新規ファイル作成のとき、ディレクトリが無ければそれも作成するようにする。
トップへ戻るリンクも追加しましょう。
そのうち読み込ませたいね
t = File.read("#{d}/#{f}.md", :encoding => Encoding::UTF_8)
Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(t)
の処理、読み込むためのファイル指定部分以外は同じ処理なので、まとめる。
markdown("#{d}/#{f}.md")
とやったらもう表示までしてくれるのが良いかな。
良くないコミットでしたね
/directory/
とアクセスすると、/directory/index
に飛ぶようにする。
……というかメインとなるファイルはindexでいいのか?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.