UNPKG

skypager-project-types-react

Version:
93 lines (62 loc) 1.45 kB
--- type: example spec: true --- # Example These are some introductory nodes. - list item one - list item two I Highlight some `Domain Specific Words` And I include [Links](toSomeShit) ## Actual Input This section contains code blocks. Skypager should be able to convert these into a module for us. ### Code Sample One ```javascript import Skypager from 'skypager' import project from 'skypager/current' export default (project) => { return project } ``` ### Code Sample Two ```javascript const project = require('skypager/current') module.exports = { getProject() { return project } } ``` ### Code Sample Three ```javascript const { project } = global project.cli.print('Hello World') ``` ## Specs ### Querying the markdown AST #### Get all of the heading nodes ```javascript const headingNodes = doc.selectHeadingNodes() headingNodes.should.not.be.empty ``` You can even pass a test function ```javascript const filtered = doc.selectHeadingNodes(n => n.depth > 3) filtered.should.not.be.empty ``` #### Get all of the code blocks ```javascript const jsNodes = doc.selectCodeBlocks('javascript') jsNodes.should.not.be.empty ``` ## Setup This code will be run once at the beginning of the document context initialization ```javascript import React from 'react' import ReactDOM from 'react-dom' ``` ## Teardown This code will be run at the end of each run ```javascript delete(global.$currentDocument) ```