Skip to content

Commit

Permalink
create orga-unified
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoxing Hu committed Aug 10, 2020
1 parent c50535c commit 304f417
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 7 deletions.
6 changes: 2 additions & 4 deletions examples/example/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const unified = require('unified')
const stream = require('unified-stream')
const parse = require('orga-unified-parse')
const orga = require('orga-unified')
const mutate = require('orga-unified-rehype')
const html = require('rehype-stringify')

const processor = unified()
.use(parse)
const processor = orga()
.use(mutate)
.use(html)

Expand Down
2 changes: 1 addition & 1 deletion examples/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"license": "ISC",
"dependencies": {
"orga-unified-rehype": "^2.0.0-next.1",
"orga-unified-parse": "^2.0.0-next.1",
"orga-unified": "^2.0.0-next.1",
"rehype-stringify": "^8.0.0",
"unified": "^9.1.0",
"unified-stream": "^1.0.6"
Expand Down
2 changes: 1 addition & 1 deletion packages/orga-unified-parse/README.org
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#+TITLE: orga-unified-parse

Parser for unified. Parses org-mode to oast syntax trees.
Parser for [[https://github.com/unifiedjs/unified][unified]]. Parses org-mode to oast syntax trees. Used in [[https://github.com/orgapp/orgajs/tree/master/packages/orga-unified][orga-unified]] processor.
3 changes: 3 additions & 0 deletions packages/orga-unified-parse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
},
"dependencies": {
"orga": "^2.0.0-next.1"
},
"devDependencies": {
"unified": "^9.1.0"
}
}
6 changes: 5 additions & 1 deletion packages/orga-unified-parse/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { parse, ParseOptions } from 'orga'
import { Plugin } from 'unified'

export = function (options: Partial<ParseOptions>) {

const _parse: Plugin = function(options: Partial<ParseOptions>) {
this.Parser = (doc: string, file) => {
return parse(doc, options)
}
}

export = _parse
2 changes: 2 additions & 0 deletions packages/orga-unified/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/lib
3 changes: 3 additions & 0 deletions packages/orga-unified/README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#+TITLE: orga-unified

[[https://github.com/unifiedjs/unified][unified]] processor to parse [[https://orgmode.org][org-mode]].
23 changes: 23 additions & 0 deletions packages/orga-unified/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "orga-unified",
"version": "2.0.0-next.1",
"description": "orga processor for unifiedjs",
"files": [
"lib"
],
"main": "lib/index.js",
"author": "Xiaoxing Hu <[email protected]>",
"license": "MIT",
"repository": "https://github.com/orgapp/orgajs/tree/master/packages/orga-unified",
"scripts": {
"build": "npm run clean && npm run compile",
"compile": "tsc -p tsconfig.build.json",
"compile:watch": "tsc -w -p tsconfig.build.json",
"prepare": "cross-env NODE_ENV=production npm run build",
"clean": "rm -rf ./lib"
},
"dependencies": {
"orga-unified-parse": "^2.0.0-next.1",
"unified": "^9.1.0"
}
}
4 changes: 4 additions & 0 deletions packages/orga-unified/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import unified from 'unified'
import parse from 'orga-unified-parse'

export = unified().use(parse).freeze()
8 changes: 8 additions & 0 deletions packages/orga-unified/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.build.json",
"compilerOptions": {
"outDir": "./lib"
},
"include": ["./src"],
"exclude": ["**/__tests__/**"]
}
8 changes: 8 additions & 0 deletions packages/orga-unified/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib"
},
"include": ["./src"],
"exclude": ["**/__tests__/**"]
}

0 comments on commit 304f417

Please sign in to comment.