Add parser experiment working with API surface.
This commit is contained in:
parent
28de2a8e20
commit
f7a37681de
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
experiments
|
||||
/experiments
|
||||
|
6
docs/experiments/package.json
Normal file
6
docs/experiments/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@terrace/core": "0.0.1"
|
||||
}
|
||||
}
|
19
docs/experiments/parser.js
Normal file
19
docs/experiments/parser.js
Normal file
@ -0,0 +1,19 @@
|
||||
import { createLineData, useDocument } from '@terrace/core'
|
||||
import { createStringReader } from '@terrace/core/readers/js-string'
|
||||
|
||||
async function main() {
|
||||
const lines = [
|
||||
`title Example`,
|
||||
`subsection`,
|
||||
` position 1`,
|
||||
` Ea dolore in aliquip fugiat anim adipisicing amet aute tempor et deserunt est duis sint.`,
|
||||
`subsection 2`,
|
||||
` position 2`,
|
||||
` Aute deserunt incididunt ad in sint adipisicing est officia velit pariatur ipsum deserunt quis nulla.`
|
||||
]
|
||||
|
||||
const rootDoc = useDocument(createStringReader(lines))
|
||||
console.log(await rootDoc.seek('subsection').then(r => r.content()))
|
||||
}
|
||||
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user