ドキュメントをMarkdownで書くように

This commit is contained in:
syuilo
2018-07-15 18:28:08 +09:00
parent d47f92f396
commit 5f5156561f
32 changed files with 165 additions and 327 deletions

3
src/docs/about.en.md Normal file
View File

@ -0,0 +1,3 @@
# About Misskey
Misskey is a mini blog SNS.

3
src/docs/about.ja.md Normal file
View File

@ -0,0 +1,3 @@
# Misskeyについて
MisskeyはミニブログSNSです。

View File

@ -0,0 +1,21 @@
@import "../style"
#url
padding 8px 12px 8px 8px
font-family Consolas, 'Courier New', Courier, Monaco, monospace
color #fff
background #222e40
border-radius 4px
> .method
display inline-block
margin 0 8px 0 0
padding 0 6px
color #f4fcff
background #17afc7
border-radius 4px
user-select none
pointer-events none
> .host
opacity 0.7

View File

@ -0,0 +1,38 @@
extends ../../layout.pug
include ../mixins
block meta
link(rel="stylesheet" href="/docs/assets/api/endpoints/style.css")
block main
h1= endpoint
p#url
span.method POST
span.host
= url.host
| /
span.path= url.path
p#desc= desc[lang] || desc['ja']
section
h2= i18n('docs.api.endpoints.params')
+propTable(params)
if paramDefs
each paramDef in paramDefs
section(id= paramDef.name)
h3= paramDef.name
+propTable(paramDef.params)
if res
section
h2= i18n('docs.api.endpoints.res')
+propTable(res)
if resDefs
each resDef in resDefs
section(id= resDef.name)
h3= resDef.name
+propTable(resDef.props)

View File

@ -0,0 +1,73 @@
name: "DriveFile"
desc:
ja: "ドライブのファイル。"
en: "A file of Drive."
props:
- name: "id"
type: "id"
optional: false
desc:
ja: "ファイルID"
en: "The ID of this file"
- name: "createdAt"
type: "date"
optional: false
desc:
ja: "アップロード日時"
en: "The upload date of this file"
- name: "userId"
type: "id(User)"
optional: false
desc:
ja: "所有者ID"
en: "The ID of the owner of this file"
- name: "user"
type: "entity(User)"
optional: true
desc:
ja: "所有者"
en: "The owner of this file"
- name: "name"
type: "string"
optional: false
desc:
ja: "ファイル名"
en: "The name of this file"
- name: "md5"
type: "string"
optional: false
desc:
ja: "ファイルのMD5ハッシュ値"
en: "The md5 hash value of this file"
- name: "type"
type: "string"
optional: false
desc:
ja: "ファイルの種類"
en: "The type of this file"
- name: "datasize"
type: "number"
optional: false
desc:
ja: "ファイルサイズ(bytes)"
en: "The size of this file (bytes)"
- name: "url"
type: "string"
optional: false
desc:
ja: "ファイルのURL"
en: "The URL of this file"
- name: "folderId"
type: "id(DriveFolder)"
optional: true
desc:
ja: "フォルダID"
en: "The ID of the folder of this file"
- name: "folder"
type: "entity(DriveFolder)"
optional: true
desc:
ja: "フォルダ"
en: "The folder of this file"

View File

@ -0,0 +1,168 @@
name: "Note"
desc:
ja: "投稿。"
en: "A note."
props:
- name: "id"
type: "id"
optional: false
desc:
ja: "投稿ID"
en: "The ID of this note"
- name: "createdAt"
type: "date"
optional: false
desc:
ja: "投稿日時"
en: "The posted date of this note"
- name: "viaMobile"
type: "boolean"
optional: true
desc:
ja: "モバイル端末から投稿したか否か(自己申告であることに留意)"
en: "Whether this note sent via a mobile device"
- name: "text"
type: "string"
optional: true
desc:
ja: "投稿の本文"
en: "The text of this note"
- name: "mediaIds"
type: "id(DriveFile)[]"
optional: true
desc:
ja: "添付されているメディアのID (なければレスポンスでは空配列)"
en: "The IDs of the attached media (empty array for response if no media is attached)"
- name: "media"
type: "entity(DriveFile)[]"
optional: true
desc:
ja: "添付されているメディア"
en: "The attached media"
- name: "userId"
type: "id(User)"
optional: false
desc:
ja: "投稿者ID"
en: "The ID of author of this note"
- name: "user"
type: "entity(User)"
optional: true
desc:
ja: "投稿者"
en: "The author of this note"
- name: "myReaction"
type: "string"
optional: true
desc:
ja: "この投稿に対する自分の<a href='/docs/api/reactions'>リアクション</a>"
en: "The your <a href='/docs/api/reactions'>reaction</a> of this note"
- name: "reactionCounts"
type: "object"
optional: false
desc:
ja: "<a href='/docs/api/reactions'>リアクション</a>をキーとし、この投稿に対するそのリアクションの数を値としたオブジェクト"
- name: "replyId"
type: "id(Note)"
optional: true
desc:
ja: "返信した投稿のID"
en: "The ID of the replyed note"
- name: "reply"
type: "entity(Note)"
optional: true
desc:
ja: "返信した投稿"
en: "The replyed note"
- name: "renoteId"
type: "id(Note)"
optional: true
desc:
ja: "引用した投稿のID"
en: "The ID of the quoted note"
- name: "renote"
type: "entity(Note)"
optional: true
desc:
ja: "引用した投稿"
en: "The quoted note"
- name: "poll"
type: "object"
optional: true
desc:
ja: "投票"
en: "The poll"
defName: "poll"
def:
- name: "choices"
type: "object[]"
optional: false
desc:
ja: "投票の選択肢"
en: "The choices of this poll"
defName: "choice"
def:
- name: "id"
type: "number"
optional: false
desc:
ja: "選択肢ID"
en: "The ID of this choice"
- name: "isVoted"
type: "boolean"
optional: true
desc:
ja: "自分がこの選択肢に投票したかどうか"
en: "Whether you voted to this choice"
- name: "text"
type: "string"
optional: false
desc:
ja: "選択肢本文"
en: "The text of this choice"
- name: "votes"
type: "number"
optional: false
desc:
ja: "この選択肢に投票された数"
en: "The number voted for this choice"
- name: "geo"
type: "object"
optional: true
desc:
ja: "位置情報"
en: "Geo location"
defName: "geo"
def:
- name: "coordinates"
type: "number[]"
optional: false
desc:
ja: "座標。最初に経度:-180〜180で表す。最後に緯度-90〜90で表す。"
- name: "altitude"
type: "number"
optional: false
desc:
ja: "高度。メートル単位で表す。"
- name: "accuracy"
type: "number"
optional: false
desc:
ja: "緯度、経度の精度。メートル単位で表す。"
- name: "altitudeAccuracy"
type: "number"
optional: false
desc:
ja: "高度の精度。メートル単位で表す。"
- name: "heading"
type: "number"
optional: false
desc:
ja: "方角。0〜360の角度で表す。0が北、90が東、180が南、270が西。"
- name: "speed"
type: "number"
optional: false
desc:
ja: "速度。メートル / 秒数で表す。"

View File

@ -0,0 +1,168 @@
name: "Note"
desc:
ja: "投稿。"
en: "A note."
props:
- name: "id"
type: "id"
optional: false
desc:
ja: "投稿ID"
en: "The ID of this note"
- name: "createdAt"
type: "date"
optional: false
desc:
ja: "投稿日時"
en: "The posted date of this note"
- name: "viaMobile"
type: "boolean"
optional: true
desc:
ja: "モバイル端末から投稿したか否か(自己申告であることに留意)"
en: "Whether this note sent via a mobile device"
- name: "text"
type: "string"
optional: true
desc:
ja: "投稿の本文 (ローカルの場合Markdown風のフォーマット)"
en: "The text of this note (in Markdown like format if local)"
- name: "mediaIds"
type: "id(DriveFile)[]"
optional: true
desc:
ja: "添付されているメディアのID (なければレスポンスでは空配列)"
en: "The IDs of the attached media (empty array for response if no media is attached)"
- name: "media"
type: "entity(DriveFile)[]"
optional: true
desc:
ja: "添付されているメディア"
en: "The attached media"
- name: "userId"
type: "id(User)"
optional: false
desc:
ja: "投稿者ID"
en: "The ID of author of this note"
- name: "user"
type: "entity(User)"
optional: true
desc:
ja: "投稿者"
en: "The author of this note"
- name: "myReaction"
type: "string"
optional: true
desc:
ja: "この投稿に対する自分の<a href='/docs/api/reactions'>リアクション</a>"
en: "The your <a href='/docs/api/reactions'>reaction</a> of this note"
- name: "reactionCounts"
type: "object"
optional: false
desc:
ja: "<a href='/docs/api/reactions'>リアクション</a>をキーとし、この投稿に対するそのリアクションの数を値としたオブジェクト"
- name: "replyId"
type: "id(Note)"
optional: true
desc:
ja: "返信した投稿のID"
en: "The ID of the replyed note"
- name: "reply"
type: "entity(Note)"
optional: true
desc:
ja: "返信した投稿"
en: "The replyed note"
- name: "renoteId"
type: "id(Note)"
optional: true
desc:
ja: "引用した投稿のID"
en: "The ID of the quoted note"
- name: "renote"
type: "entity(Note)"
optional: true
desc:
ja: "引用した投稿"
en: "The quoted note"
- name: "poll"
type: "object"
optional: true
desc:
ja: "投票"
en: "The poll"
defName: "poll"
def:
- name: "choices"
type: "object[]"
optional: false
desc:
ja: "投票の選択肢"
en: "The choices of this poll"
defName: "choice"
def:
- name: "id"
type: "number"
optional: false
desc:
ja: "選択肢ID"
en: "The ID of this choice"
- name: "isVoted"
type: "boolean"
optional: true
desc:
ja: "自分がこの選択肢に投票したかどうか"
en: "Whether you voted to this choice"
- name: "text"
type: "string"
optional: false
desc:
ja: "選択肢本文"
en: "The text of this choice"
- name: "votes"
type: "number"
optional: false
desc:
ja: "この選択肢に投票された数"
en: "The number voted for this choice"
- name: "geo"
type: "object"
optional: true
desc:
ja: "位置情報"
en: "Geo location"
defName: "geo"
def:
- name: "coordinates"
type: "number[]"
optional: false
desc:
ja: "座標。最初に経度:-180〜180で表す。最後に緯度-90〜90で表す。"
- name: "altitude"
type: "number"
optional: false
desc:
ja: "高度。メートル単位で表す。"
- name: "accuracy"
type: "number"
optional: false
desc:
ja: "緯度、経度の精度。メートル単位で表す。"
- name: "altitudeAccuracy"
type: "number"
optional: false
desc:
ja: "高度の精度。メートル単位で表す。"
- name: "heading"
type: "number"
optional: false
desc:
ja: "方角。0〜360の角度で表す。0が北、90が東、180が南、270が西。"
- name: "speed"
type: "number"
optional: false
desc:
ja: "速度。メートル / 秒数で表す。"

View File

@ -0,0 +1 @@
@import "../style"

View File

@ -0,0 +1,177 @@
name: "User"
desc:
ja: "ユーザー。"
en: "A user."
props:
id:
type: "id"
optional: false
desc:
ja: "ユーザーID"
en: "The ID of this user"
createdAt:
type: "date"
optional: false
desc:
ja: "アカウント作成日時"
en: "The registered date of this user"
username:
type: "string"
optional: false
desc:
ja: "ユーザー名"
en: "The username of this user"
description:
type: "string"
optional: false
desc:
ja: "アカウントの説明(自己紹介)"
en: "The description of this user"
avatarId:
type: "id(DriveFile)"
optional: true
desc:
ja: "アバターのID"
en: "The ID of the avatar of this user"
avatarUrl:
type: "string"
optional: false
desc:
ja: "アバターのURL"
en: "The URL of the avatar of this user"
bannerId:
type: "id(DriveFile)"
optional: true
desc:
ja: "バナーのID"
en: "The ID of the banner of this user"
bannerUrl:
type: "string"
optional: false
desc:
ja: "バナーのURL"
en: "The URL of the banner of this user"
followersCount:
type: "number"
optional: false
desc:
ja: "フォロワーの数"
en: "The number of the followers for this user"
followingCount:
type: "number"
optional: false
desc:
ja: "フォローしているユーザーの数"
en: "The number of the following users for this user"
isFollowing:
type: "boolean"
optional: true
desc:
ja: "自分がこのユーザーをフォローしているか"
isFollowed:
type: "boolean"
optional: true
desc:
ja: "自分がこのユーザーにフォローされているか"
isMuted:
type: "boolean"
optional: true
desc:
ja: "自分がこのユーザーをミュートしているか"
en: "Whether you muted this user"
notesCount:
type: "number"
optional: false
desc:
ja: "投稿の数"
en: "The number of the notes of this user"
pinnedNote:
type: "entity(Note)"
optional: true
desc:
ja: "ピン留めされた投稿"
en: "The pinned note of this user"
pinnedNoteId:
type: "id(Note)"
optional: true
desc:
ja: "ピン留めされた投稿のID"
en: "The ID of the pinned note of this user"
driveCapacity:
type: "number"
optional: false
desc:
ja: "ドライブの容量(bytes)"
en: "The capacity of drive of this user (bytes)"
host:
type: "string | null"
optional: false
desc:
ja: "ホスト (例: example.com:3000)"
en: "Host (e.g. example.com:3000)"
twitter:
type: "object"
optional: true
desc:
ja: "連携されているTwitterアカウント情報"
en: "The info of the connected twitter account of this user"
props:
userId:
type: "string"
optional: false
desc:
ja: "ユーザーID"
en: "The user ID"
screenName:
type: "string"
optional: false
desc:
ja: "ユーザー名"
en: "The screen name of this user"
isBot:
type: "boolean"
optional: true
desc:
ja: "botか否か(自己申告であることに留意)"
en: "Whether is bot or not"
profile:
type: "object"
optional: false
desc:
ja: "プロフィール"
en: "The profile of this user"
props:
location:
type: "string"
optional: true
desc:
ja: "場所"
en: "The location of this user"
birthday:
type: "string"
optional: true
desc:
ja: "誕生日 (YYYY-MM-DD)"
en: "The birthday of this user (YYYY-MM-DD)"

View File

@ -0,0 +1,20 @@
extends ../../layout.pug
include ../mixins
block meta
link(rel="stylesheet" href="/docs/assets/api/entities/style.css")
block main
h1= name
p#desc= desc[lang] || desc['ja']
section
h2= i18n('docs.api.entities.properties')
+propTable(props)
if propDefs
each propDef in propDefs
section(id= propDef.name)
h3= propDef.name
+propTable(propDef.props)

31
src/docs/api/mixins.pug Normal file
View File

@ -0,0 +1,31 @@
mixin propTable(props)
table.props
thead: tr
th= i18n('docs.api.props.name')
th= i18n('docs.api.props.type')
th= i18n('docs.api.props.description')
tbody
each prop in props
tr
td.name= prop.name
td.type
i= prop.type
if prop.kind == 'id'
if prop.entity
| (
a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity
| ID)
else
| (ID)
else if prop.kind == 'entity'
| (
a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity
| )
else if prop.kind == 'object'
if prop.hasDef
| (
a(href=`#${prop.name}`)= prop.name
| )
else if prop.kind == 'date'
| (Date)
td.desc!= prop.desc ? prop.desc[lang] || prop.desc['ja'] : null

11
src/docs/api/style.styl Normal file
View File

@ -0,0 +1,11 @@
@import "../style"
table.props
.name
font-weight bold
.name
.type
.optional
font-family Consolas, 'Courier New', Courier, Monaco, monospace

4
src/docs/article.pug Normal file
View File

@ -0,0 +1,4 @@
extends ./layout.pug
block main
!= html

41
src/docs/layout.pug Normal file
View File

@ -0,0 +1,41 @@
doctype html
html(lang= lang)
head
meta(charset="UTF-8")
meta(name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no")
title
| #{title} | Misskey Docs
link(rel="stylesheet" href="/docs/assets/style.css")
block meta
//- FontAwesome style
style #{facss}
body
nav
ul
each doc in docs
li: a(href=`/docs/${lang}/${doc.name}`)= doc.title[lang] || doc.title['ja']
section
h2 API
ul
li Entities
ul
each entity in entities
li: a(href=`/docs/${lang}/api/entities/${kebab(entity)}`)= entity
li Endpoints
ul
each endpoint in endpoints
li: a(href=`/docs/${lang}/api/endpoints/${kebab(endpoint)}`)= endpoint
main
article
block main
if content
| !{content}
footer
p
| %i18n:docs.edit-this-page-on-github%
a(href=src target="_blank") %i18n:docs.edit-this-page-on-github-link%
small= copyright

120
src/docs/style.styl Normal file
View File

@ -0,0 +1,120 @@
@import "../client/style"
@import "./ui"
body
margin 0
color #34495e
word-break break-word
main
margin 0 0 0 256px
padding 64px
width 100%
max-width 800px
section
margin 32px 0
h1
margin 0 0 24px 0
padding 16px 0
font-size 1.5em
border-bottom solid 2px #eee
h2
margin 0 0 24px 0
padding 0 0 16px 0
font-size 1.4em
border-bottom solid 1px #eee
h3
margin 0
padding 0
font-size 1.25em
h4
margin 0
p
margin 1em 0
line-height 1.6em
footer
margin 32px 0 0 0
border-top solid 2px #eee
> small
margin 16px 0 0 0
color #aaa
nav
display block
position fixed
z-index 10000
top 0
left 0
width 256px
height 100%
overflow auto
padding 32px
background #fff
border-right solid 2px #eee
@media (max-width 1025px)
main
margin 0
max-width 100%
nav
position relative
width 100%
max-height 128px
background #f9f9f9
border-right none
@media (max-width 768px)
main
padding 32px
@media (max-width 512px)
main
padding 16px
table
display block
width 100%
max-width 100%
overflow auto
border-spacing 0
border-collapse collapse
thead
font-weight bold
border-bottom solid 2px #eee
tr
th
text-align left
tbody
tr
&:nth-child(odd)
background #fbfbfb
th, td
padding 8px 16px
min-width 128px
code
display inline-block
padding 8px 10px
font-family Consolas, 'Courier New', Courier, Monaco, monospace
color #295c92
background #f2f2f2
border-radius 4px
pre
overflow auto
> code
display block

19
src/docs/ui.styl Normal file
View File

@ -0,0 +1,19 @@
.ui.info
display block
margin 1em 0
padding 0 1em
font-size 90%
color rgba(#000, 0.87)
background #f8f8f9
border-radius 4px
overflow hidden
> p
opacity 0.8
> [data-fa]:first-child
margin-right 0.25em
&.warn
color #573a08
background #FFFAF3