WIP - add extractor, generate snippet_data
This commit is contained in:
18
node_modules/unist-util-remove-position/index.js
generated
vendored
Normal file
18
node_modules/unist-util-remove-position/index.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
'use strict'
|
||||
|
||||
var visit = require('unist-util-visit')
|
||||
|
||||
module.exports = removePosition
|
||||
|
||||
function removePosition(node, force) {
|
||||
visit(node, force ? hard : soft)
|
||||
return node
|
||||
}
|
||||
|
||||
function hard(node) {
|
||||
delete node.position
|
||||
}
|
||||
|
||||
function soft(node) {
|
||||
node.position = undefined
|
||||
}
|
||||
22
node_modules/unist-util-remove-position/license
generated
vendored
Normal file
22
node_modules/unist-util-remove-position/license
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
112
node_modules/unist-util-remove-position/package.json
generated
vendored
Normal file
112
node_modules/unist-util-remove-position/package.json
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
{
|
||||
"_from": "unist-util-remove-position@^1.1.2",
|
||||
"_id": "unist-util-remove-position@1.1.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-CtszTlOjP2sBGYc2zcKA/CvNdTdEs3ozbiJ63IPBxh8iZg42SCCb8m04f8z2+V1aSk5a7BxbZKEdoDjadmBkWA==",
|
||||
"_location": "/unist-util-remove-position",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "unist-util-remove-position@^1.1.2",
|
||||
"name": "unist-util-remove-position",
|
||||
"escapedName": "unist-util-remove-position",
|
||||
"rawSpec": "^1.1.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gatsby-transformer-remark",
|
||||
"/remark-parse"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.3.tgz",
|
||||
"_shasum": "d91aa8b89b30cb38bad2924da11072faa64fd972",
|
||||
"_spec": "unist-util-remove-position@^1.1.2",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/gatsby-transformer-remark",
|
||||
"author": {
|
||||
"name": "Titus Wormer",
|
||||
"email": "tituswormer@gmail.com",
|
||||
"url": "https://wooorm.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/syntax-tree/unist-util-remove-position/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Titus Wormer",
|
||||
"email": "tituswormer@gmail.com",
|
||||
"url": "https://wooorm.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"unist-util-visit": "^1.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Remove `position`s from a unist tree",
|
||||
"devDependencies": {
|
||||
"browserify": "^16.0.0",
|
||||
"nyc": "^14.0.0",
|
||||
"prettier": "^1.0.0",
|
||||
"remark": "^10.0.0",
|
||||
"remark-cli": "^6.0.0",
|
||||
"remark-preset-wooorm": "^5.0.0",
|
||||
"tape": "^4.0.0",
|
||||
"tinyify": "^2.0.0",
|
||||
"unist-builder": "^1.0.0",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/syntax-tree/unist-util-remove-position#readme",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"utility",
|
||||
"remove",
|
||||
"position",
|
||||
"location"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "unist-util-remove-position",
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/syntax-tree/unist-util-remove-position.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"build-bundle": "browserify . -s unistUtilRemovePosition > unist-util-remove-position.js",
|
||||
"build-mangle": "browserify . -s unistUtilRemovePosition -p tinyify > unist-util-remove-position.min.js",
|
||||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
|
||||
"test": "npm run format && npm run build && npm run test-coverage",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js"
|
||||
},
|
||||
"version": "1.1.3",
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"ignores": [
|
||||
"unist-util-remove-position.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
131
node_modules/unist-util-remove-position/readme.md
generated
vendored
Normal file
131
node_modules/unist-util-remove-position/readme.md
generated
vendored
Normal file
@ -0,0 +1,131 @@
|
||||
# unist-util-remove-position
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
[![Sponsors][sponsors-badge]][collective]
|
||||
[![Backers][backers-badge]][collective]
|
||||
[![Chat][chat-badge]][chat]
|
||||
|
||||
[**unist**][unist] utility to remove [`position`][position]s from tree.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install unist-util-remove-position
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var remark = require('remark')
|
||||
var removePosition = require('unist-util-remove-position')
|
||||
|
||||
var tree = remark().parse('Some _emphasis_, **importance**, and `code`.')
|
||||
|
||||
removePosition(tree, true)
|
||||
|
||||
console.dir(tree, {depth: null})
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'root',
|
||||
children: [
|
||||
{
|
||||
type: 'paragraph',
|
||||
children: [
|
||||
{ type: 'text', value: 'Some ' },
|
||||
{
|
||||
type: 'emphasis',
|
||||
children: [ { type: 'text', value: 'emphasis' } ]
|
||||
},
|
||||
{ type: 'text', value: ', ' },
|
||||
{
|
||||
type: 'strong',
|
||||
children: [ { type: 'text', value: 'importance' } ]
|
||||
},
|
||||
{ type: 'text', value: ', and ' },
|
||||
{ type: 'inlineCode', value: 'code' },
|
||||
{ type: 'text', value: '.' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `removePosition(node[, force])`
|
||||
|
||||
Remove [`position`][position]s from [`node`][node].
|
||||
If `force` is given, uses `delete`, otherwise, sets `position`s to `undefined`.
|
||||
|
||||
###### Returns
|
||||
|
||||
The given `node`.
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
|
||||
started.
|
||||
See [`support.md`][support] for ways to get help.
|
||||
|
||||
This project has a [Code of Conduct][coc].
|
||||
By interacting with this repository, organisation, or community you agree to
|
||||
abide by its terms.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-remove-position.svg
|
||||
|
||||
[build]: https://travis-ci.org/syntax-tree/unist-util-remove-position
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-remove-position.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/unist-util-remove-position
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-remove-position.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/unist-util-remove-position
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-remove-position.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=unist-util-remove-position
|
||||
|
||||
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
||||
|
||||
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
||||
|
||||
[collective]: https://opencollective.com/unified
|
||||
|
||||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
|
||||
|
||||
[chat]: https://spectrum.chat/unified/syntax-tree
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md
|
||||
|
||||
[support]: https://github.com/syntax-tree/.github/blob/master/support.md
|
||||
|
||||
[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
|
||||
|
||||
[unist]: https://github.com/syntax-tree/unist
|
||||
|
||||
[position]: https://github.com/syntax-tree/unist#position
|
||||
|
||||
[node]: https://github.com/syntax-tree/unist#node
|
||||
Reference in New Issue
Block a user