scrapbox記法をmarkdownに変換するparserをrustで書く
対象のURL
https://scrapbox.io/api/pages/razokulover-tech-memo/Rust%E3%81%AB%E5%85%A5%E9%96%80%E3%81%99%E3%82%8B
cli化する
scrapbox pageを取得
reqwestで通信したリクエストとレスポンスのオブジェクトへのシリアライズはserde_jsonを使う。JSON to Objectはserde_jsonを使うと下記のような定義を行うだけで楽にできる。 code:example.rs
struct ScrapboxPage {
id: String,
lines: Vec<ScrapboxLine>,
}
struct ScrapboxLine {
id: String,
text: String,
}
fn main() {
}
コードブロックのパース
code:hoge.rs
fn main() -> {
println!("{}", "Hello World!");
}
code:hoge.rs
fn main() -> {
println!("{}", "Hello, World!");
}
テーブルのパース
table:hoge
a
b
table:bar
a b c
A B C
table:表
ツール 使い方
たすくま タスクの実行管理、終了予定時刻予測
omnifocus GTD準拠ツール、evernoteと連携機能あり
evernote アーカイブ
OneNote 職場でのタスク管理ツール
正規表現
structに定数定義できるか?
できる
a
b
c
d
三項演算子
無い。ifの式として書く。
見出しのパース
test
test
test
test
画像のパース
https://scrapbox.io/files/62a88140239c3a002394fbd7.png
リリースどうするか
cargo installで入れられるようにcrate公開するか?
管理していくのだるい
バイナリ公開するか?
これは便利そうだが、openssl周りのエラーで解決するのだるい
GitHub Actionsを整えたりするの結構だるいな...
binとしてもlibとしてもpackageを公開したい場合