top

Cartesian Theater

Powered by NotionAPI

20211120

Date: 2021-11-20
Last Edited: 2022-01-31 16:51:00

Notion APIのアップデートで引用やコードブロックが取得できるようになっていたので実装してみた。

0.2.2 → 0.4.9でかなりアップデートが入っている様子で他にも画像などいろいろ取得できそう。APIで取得するブロックの種類の型定義をVSCodeでみると以下のようにいろいろ入っていた。

(property) type: "paragraph" | "link_preview" | "equation" | "heading_1" | "heading_2" | "heading_3" | "bulleted_list_item" | "numbered_list_item" | "quote" | "to_do" | "toggle" | "template" | ... 18 more ... | "unsupported"

詳しい仕様は以下

コードブロックのシンタックスハイライトについてはこちらを参考にした。

以下スタイルのテスト用

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
const codeBlockTest = () => {
	const hoge = 'hoge';
	return hoge;
};
let rust_test = Vec::<String>::new();
def python_test(){
	test = 'test'
	return python_test
}
select 
	* 
from 
	sql_test a 
	inner join test_table b 
	on a.hoge = b.fuga 
where 
	a.hoge = 'hoge' 
	and b.fuga = 'fuga'
;
©︎2021 Yuki Oshima