Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

采用 YAML header 作为元数据的书写格式 #1

Closed
cssmagic opened this issue May 13, 2022 · 2 comments
Closed

采用 YAML header 作为元数据的书写格式 #1

cssmagic opened this issue May 13, 2022 · 2 comments
Labels

Comments

@cssmagic
Copy link
Owner

cssmagic commented May 13, 2022

背景

需要在 Markdown 文件内添加一些元数据,以便 Kup 正确投递。

考虑到在 Markdown 顶部添加 YAML 格式的元数据已是较为普遍的做法:

因此,Kup 也打算采用这种方式。

示意

---
title: The title of this issue
repo: cssmagic/kup
id: 168
tags:
  - JS
  - RFC
---

Markdown 正文
Markdown 正文
Markdown 正文
@cssmagic cssmagic added the RFC label May 15, 2022
@cssmagic
Copy link
Owner Author

cssmagic commented May 20, 2022

几年前写过 类似的设计方案。发到这里仅作参考之用:

  • title -- 字符串。同步到 GitHub issue 时使用的标题。若此项未指定则在正文提取第一个 h1 元素的内容;若未找到,则顺延至第一个 h2 元素;以此类推。
  • repo -- 字符串。格式为 username/repo。当此项未指定时,Writer 会提示输入并写回(或提示错误并退出——这取决于实现到了什么程度)。
  • issue -- 数字。格式为 123。当此项未指定时,Writer 会发布一个新 issue,并将 issue 号写回此配置项。
  • tags -- 字符串或列表。格式为 GitGit jQuery[Git, jQuery]。为同步出去的 issue 打标签(在 GitHub issue 体系中,标签被称为 “Label”)。具体行为待定。
  • author -- 字符串,GitHub 用户名。告诉 Writer 以哪个用户的身份发布(或同步)issue。当此项未指定时,会取 repo 配置项中的 username 部分;如果取到的用户名不在 Writer 预定义的用户名单中,则提示错误并退出。

@cssmagic
Copy link
Owner Author

此功能已在 v0.1 实现。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant