-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
130 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"myst-directives": minor | ||
--- | ||
|
||
Add `aside` directive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { DirectiveSpec, DirectiveData, GenericNode } from 'myst-common'; | ||
import type { Aside } from 'myst-spec-ext'; | ||
import type { FlowContent, ListContent, PhrasingContent } from 'myst-spec'; | ||
|
||
export const asideDirective: DirectiveSpec = { | ||
name: 'aside', | ||
alias: ['margin', 'sidebar'], | ||
body: { | ||
type: 'myst', | ||
required: true, | ||
}, | ||
run(data: DirectiveData): GenericNode[] { | ||
const aside: Aside = { | ||
type: 'aside', | ||
kind: | ||
data.name == 'aside' || data.name == 'margin' ? undefined : (data.name as Aside['kind']), | ||
children: data.body as (FlowContent | ListContent | PhrasingContent)[], | ||
}; | ||
return [aside]; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"extends": "../tsconfig/base.json", | ||
"compilerOptions": { | ||
"outDir": "dist" | ||
"outDir": "dist", | ||
}, | ||
"include": ["."], | ||
"exclude": ["dist", "build", "node_modules", "src/**/*.spec.ts", "tests"] | ||
"exclude": ["dist", "build", "node_modules", "src/**/*.spec.ts", "tests"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
title: aside directive | ||
cases: | ||
- title: aside directive parses | ||
markdown: |- | ||
```{aside} | ||
Some good aside content | ||
*Cool!* | ||
``` | ||
mdast: | ||
type: root | ||
children: | ||
- type: mystDirective | ||
name: aside | ||
value: |- | ||
Some good aside content | ||
*Cool!* | ||
children: | ||
- type: aside | ||
children: | ||
- type: paragraph | ||
children: | ||
- type: text | ||
value: Some good aside content | ||
- type: paragraph | ||
children: | ||
- type: emphasis | ||
children: | ||
- type: text | ||
value: Cool! | ||
- title: margin directive parses | ||
markdown: |- | ||
```{margin} | ||
Some good margin content | ||
*Cool!* | ||
``` | ||
mdast: | ||
type: root | ||
children: | ||
- type: mystDirective | ||
name: margin | ||
value: |- | ||
Some good margin content | ||
*Cool!* | ||
children: | ||
- type: aside | ||
children: | ||
- type: paragraph | ||
children: | ||
- type: text | ||
value: Some good margin content | ||
- type: paragraph | ||
children: | ||
- type: emphasis | ||
children: | ||
- type: text | ||
value: Cool! | ||
- title: sidebar directive parses | ||
markdown: |- | ||
```{sidebar} | ||
Some good sidebar content | ||
*Cool!* | ||
``` | ||
mdast: | ||
type: root | ||
children: | ||
- type: mystDirective | ||
name: sidebar | ||
value: |- | ||
Some good sidebar content | ||
*Cool!* | ||
children: | ||
- type: aside | ||
kind: sidebar | ||
children: | ||
- type: paragraph | ||
children: | ||
- type: text | ||
value: Some good sidebar content | ||
- type: paragraph | ||
children: | ||
- type: emphasis | ||
children: | ||
- type: text | ||
value: Cool! |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"extends": "../tsconfig/base.json", | ||
"compilerOptions": { | ||
"outDir": "dist" | ||
"outDir": "dist", | ||
}, | ||
"include": ["."], | ||
"exclude": ["dist", "build", "node_modules", "src/**/*.spec.ts", "tests"] | ||
"exclude": ["dist", "build", "node_modules", "src/**/*.spec.ts", "tests"], | ||
} |