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

🔄 Redefine schema in terms of @types/mdast #67

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4b0e828
wip
agoose77 Oct 21, 2024
0d244c6
wip: all types
agoose77 Oct 21, 2024
23dfd08
fix: more type fixes
agoose77 Oct 21, 2024
1442acc
feat: add schema output
agoose77 Oct 21, 2024
500e861
fix: add containers
agoose77 Oct 21, 2024
4396156
chore: drop build
agoose77 Oct 21, 2024
0534335
docs: remove mention of deviation
agoose77 Oct 21, 2024
2657958
chore: add lint
agoose77 Oct 21, 2024
7405799
docs: add docstrings
agoose77 Oct 21, 2024
c479954
chore: update workflow
agoose77 Oct 21, 2024
6b6c915
fix: make meta optional
agoose77 Oct 22, 2024
9661dd5
fix: correct node name
agoose77 Oct 22, 2024
0d16cfb
wip: tset-generation infra
agoose77 Oct 22, 2024
1a3b77e
fix: update examples to wrap bare text
agoose77 Oct 22, 2024
505f295
fix: make children and value required
agoose77 Oct 22, 2024
9e4a3e8
fix: more nodes should be opt-in association
agoose77 Oct 22, 2024
d0b1eee
fix: class for image and code
agoose77 Oct 22, 2024
2bde57c
fix: support Image.align
agoose77 Oct 22, 2024
3f26261
fix: support Image.width
agoose77 Oct 22, 2024
dbf116d
fix: use existing Table
agoose77 Oct 22, 2024
9b38f35
fix: table examples
agoose77 Oct 22, 2024
23ec2d3
fix: specify missing children
agoose77 Oct 22, 2024
4ffa33c
fix: only lint src
agoose77 Oct 22, 2024
815c0fd
feat!: drop schema output
agoose77 Oct 23, 2024
b6ea153
fix: use object type to fix schema generation
agoose77 Oct 23, 2024
583d289
Revert "feat!: drop schema output"
agoose77 Oct 23, 2024
a543efa
chore: restructure
agoose77 Oct 23, 2024
6798dbb
fix: use eslintrc
agoose77 Oct 24, 2024
f7cf8f1
feat: prepare for API docs
agoose77 Oct 24, 2024
9e5d525
feat: add AST generation
agoose77 Oct 24, 2024
b708a74
fix: embed spec in div
agoose77 Oct 24, 2024
65ad719
feat: work on examples
agoose77 Oct 25, 2024
bb4e4e8
fix: use commonmark in tsdoc comment
agoose77 Oct 25, 2024
8c6f82d
fix: example for mystTarget
agoose77 Oct 25, 2024
49f8c7f
feat: show array types as footnotes
agoose77 Oct 25, 2024
3f82f8f
fix: don't export Association mixin
agoose77 Oct 25, 2024
1a3d010
fix: add break case example
agoose77 Oct 25, 2024
a745126
feat: add up-to-date scripts
agoose77 Oct 25, 2024
ad5518e
fix: missing files
agoose77 Oct 25, 2024
a938508
fix: drop build step
agoose77 Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:prettier/recommended"
],
"globals": {
Expand All @@ -20,7 +19,7 @@
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": ["./tsconfig.json"]
"project": ["./src/tsconfig.json", "./test/tsconfig.json"]
},
"plugins": ["@typescript-eslint", "no-skip-tests", "no-only-tests"],
"rules": {
Expand All @@ -41,7 +40,7 @@
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts", ".spec.ts"]
"extensions": [".js", ".ts"]
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/lint_and_unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js 12.x
uses: actions/setup-node@v1
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 12.x
node-version: 20.x
- run: npm install
- run: npm run lint

build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [20.x]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- name: Run the tests and generate coverage reportst
- name: Run the tests
run: npm run test
- run: npm run build
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ index.js
docs/_build
docs/examples/*.md
docs/nodes
docs/myst.schema.md
docs/myst.schema.md
*.tsbuildinfo
build
1 change: 0 additions & 1 deletion docs/commonmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ A basic Markdown Abstract Syntax Tree, mdast, is defined at [](https://github.co

## Deviations commonmark mdast

- According to the mdast spec [list items](https://github.com/syntax-tree/mdast#listitem) may only have [flow content](https://github.com/syntax-tree/mdast#flowcontent) children. However, according to the commonmark spec, list items may also be flow or phrasing content, such as [text](https://spec.commonmark.org/0.30/#example-255). This depends on spacing between the list items in the original document. In myst-spec, we choose to follow the commonmark spec and allow `ListItem` children to be `FlowContent` or `PhrasingContent`.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct w.r.t the CommonMark spec:

- one

two

produces this CommonMark AST:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">

<document xmlns="http://commonmark.org/xml/1.0">
  <list type="bullet" tight="true">
    <item>
      <paragraph>
        <text>one</text>
      </paragraph>
    </item>
  </list>
  <paragraph>
    <text>two</text>
  </paragraph>
</document>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this saying that we default to having a paragraph instead of text directly in the list item? Which is what is created?

Copy link
Author

@agoose77 agoose77 Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our documentation states that

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">

<document xmlns="http://commonmark.org/xml/1.0">
  <list type="bullet" tight="true">
    <item>
      <text>one</text>
    </item>
  </list>
</document>

is permitted by the CommonMark spec. I don't see any evidence that that is the case. What I did notice is that the HTML renderer doesn't show the <p>, but I think that might be a rendering difference rather than a spec difference.

I noticed this because whilst the spec page shows <li>TEXT</li> in the inline example, the actual examples file does not. EDIT: oops, off-by-one error :P

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To add -- if my conclusion here is incorrect, then typing this proves quite hard because it is not easy/possible to extend an existing type and change the type of children in that manner.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow... yeah, wild that the html doesn't show the <p> despite it being in the AST! Oof, good catch.

- The commonmark spec presents `+++` as an invalid thematic break in [example 44](https://spec.commonmark.org/0.30/#example-44). However, in Myst `+++` is a block break, a non-commonmark feature. Therefore we simply removed example 44 in our test cases.
Loading