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