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

Markdownパーサーを作りたい #98

Closed
ddddddO opened this issue Oct 22, 2022 · 4 comments
Closed

Markdownパーサーを作りたい #98

ddddddO opened this issue Oct 22, 2022 · 4 comments

Comments

@ddddddO
Copy link
Owner

ddddddO commented Oct 22, 2022

  • 入力として対応しているのがMarkdownの - のみなので、他の記法も対応したい
  • 構文解析器を作りたい
@ddddddO
Copy link
Owner Author

ddddddO commented Oct 24, 2022

たぶん、https://github.com/winebarrel/cronplan が参考になる気がする

@ddddddO
Copy link
Owner Author

ddddddO commented Nov 3, 2022

# xxx
## aaa
## bbb

なmdは、以下と同様なイメージでいた。

- xxx
  - aaa
  - bbb

しかし、

# xxx
- aaa
- bbb

## yyy
- ccc
- ddd

はどう考えよう。以下がよいか?

案①(h要素はroot node扱い)

- xxx
  - aaa
  - bbb
- yyy
  - ccc
  - ddd

案②(h1要素がroot node扱い)

- xxx
  - aaa
  - bbb
- yyy   <- これ以降の階層の考え方をどうしようか。yyyをbbbと同階層にする?##でなく、###だった場合は?
  - ccc
  - ddd

案①の方が楽っちゃ楽そう。

@ddddddO
Copy link
Owner Author

ddddddO commented Nov 3, 2022

案①で考える

  • 行頭が#で始まる場合はその行がroot nodeで、次に#で始まる行が現れるまではそのroot nodeの子孫nodeになる
  • マークダウンの1行目の行頭が-で始まる場合はその行がroot nodeで、次に
    • 行頭が-で始まる行が現れるまではそのroot nodeの子孫nodeになる
    • 行頭が#で始まる行が現れるまではそのroot nodeの子孫nodeになる

@ddddddO ddddddO mentioned this issue Nov 4, 2022
@ddddddO
Copy link
Owner Author

ddddddO commented Nov 4, 2022

一旦これでいい

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

No branches or pull requests

1 participant