$

md2apiについて

Markdownからjsonを生成して, REST APIっぽくGitHub Pagesで公開した備忘録

経緯

sumeshi.github.io を改装するにあたって, ちょっと変わった作りにしたいなと思ったので

md2api

GitHub sumeshi/md2api loading… github.com/sumeshi/md2api

実行したディレクトリ配下のMarkdownファイルをすべてhtmlに変換して, REST APIっぽいjsonを生成しています.
記事タイトルはファイル名から, 概要はh1タグの直後にあるpタグから, 公開日はgitの最終変更履歴からとっています.

このあたりはMarkdownの冒頭にyamlコードを挿入するか迷ったんですが, ある程度適当に書いてもなんとかなることを優先しました.

変換されたAPIには, 下記のようにアクセスできます.

元ファイル: https://github.com/sumeshi/api/md2api.md

記事一覧: https://sumeshi.github.io/api/posts/
記事単体: https://sumeshi.github.io/api/posts/md2api

TODO

今の所記事数が少ないので困っていないのですが, 実行速度がネックになってきたら高速な言語で書き直そうかなと思っています. そのうち本文を形態素解析して自動タグ付けでもしよっかな〜と考えています.

Privacy Policy

This website uses Google Analytics to collect traffic information for site improvement. Google Analytics may use cookies and similar technologies to measure page views and usage patterns.

By continuing to use this site, you acknowledge that your site usage may be recorded for analytics purposes.

Disclaimer

The content published on this website is based on publicly accessible information available on the Internet and other open sources, and represents the author's personal views. Paid training materials, non-public materials, and similar sources are not used as information sources.

The content of this website does not represent the views, policies, or positions of any organization, group, company, or other third party with which the author is affiliated or has a relationship.

No warranty is made as to the accuracy, completeness, or usefulness of the information on this website. The author assumes no responsibility for any damages arising from the use of, or inability to use, the content of this website.