9.0.0 • Published 5 years ago
@enkidevs/curriculum-compiler-react v9.0.0
Enki Curriculum Processors
Note: The language used here follows this pattern:
- an
X parsertransforms content from format X to an AST (abstract syntax tree) - an
X compilertransforms content from an AST to format X
Enki curriculum processors are divided into packages:
- @enkidevs/curriculum-compiler-json
- Compile parsed curriculum AST into a more user-friendly JSON
- @enkidevs/curriculum-compiler-react
- Compile parsed curriculum AST into a React tree
- @enkidevs/curriculum-compiler-string
- Compile parsed curriculum AST into a string
- @enkidevs/curriculum-helpers
- Helpers for processing the curriculum
- @enkidevs/curriculum-parser-json
- Parse curriculum json into an AST
- @enkidevs/curriculum-parser-markdown
- Parse curriculum markdown string into an AST
The text processing architecture of Enki curriculum is based on unifiedjs, using its markdown interfaces via remarkjs.
If this is your first time interacting with the curriculum processing tools, and/or if you do not have prior experience with unifiedjs, we suggest you check out their guides before proceeding.
The process done on the curriculum by these packages can be summarized as:
parsing -> transforming -> compiling
The curriculum-parser-markdown and the curriculum-compiler folders have an index.sandbox.js file at their respective root levels who's purpose is to serve as a playground.
Checkout the individual packages for more details.
API
const {
contentTypes
} = require('@enkidevs/curriculum-helpers')
const {
getParser
} = require('@enkidevs/curriculum-parser-markdown')
const {
getCompiler
} = require('@enkidevs/curriculum-compiler-string')
const parser = getParser(contentTypes.INSIGHT)
const ast = parser.parseSync('some markdown string')
const compiler = getCompiler(contentTypes.INSIGHT)
const markdownString = compiler.compileSync(ast)