UNPKG

1.87 kBMarkdownView Raw
1---
2type: example
3spec: true
4metadata:
5 key1: value1
6 key2: value2
7 flag: true
8 tags:
9 - examples
10 - specs
11---
12
13# Example
14
15These are some introductory nodes.
16
17- list item one
18- list item two
19
20I Highlight some `Domain Specific Words`
21
22And I include [Links](toSomeShit "This is a Title")
23
24Here is a [Reference Style Link][EXAMPLE.spec.md]
25
26Here is an Image: ![Alt Text](assets/skypager-logo-1024 "Skypager Logo")
27
28Here is a ![Reference Image][skypagerLogo]
29
30## Actual Input
31
32This section contains code blocks. Skypager should be able to convert these into a module for us.
33
34### Code Sample One
35
36```javascript
37import Skypager from 'skypager'
38import project from 'skypager/current'
39
40export default (project) => {
41 return project
42}
43```
44
45### Code Sample Two
46
47```javascript
48const project = require('skypager/current')
49
50module.exports = {
51 getProject() {
52 return project
53 }
54}
55```
56
57### Code Sample Three
58
59```javascript
60const { project } = global
61
62project.cli.print('Hello World')
63```
64
65## Specs
66
67### Querying the markdown AST
68
69#### Get all of the heading nodes
70
71```javascript
72const headingNodes = doc.selectHeadingNodes()
73headingNodes.should.not.be.empty
74```
75
76You can even pass a test function
77
78```javascript
79const filtered = doc.selectHeadingNodes(n => n.depth > 3)
80
81filtered.should.not.be.empty
82```
83
84#### Get all of the code blocks
85
86```javascript
87const jsNodes = doc.selectCodeBlocks('javascript')
88jsNodes.should.not.be.empty
89```
90
91## Setup
92
93This code will be run once at the beginning of the document context initialization
94
95```javascript
96import React from 'react'
97import ReactDOM from 'react-dom'
98```
99
100## Teardown
101
102This code will be run at the end of each run
103
104```javascript
105doc.teardownComplete = true
106```
107
108## Links
109
110[EXAMPLE.spec.md]: "https://skypager.io" "This is a Title Man"
111[skypagerLogo]: "assets/skypager-logo-1024.png" "Skypager 1024x1024 Logo"