WIP - add extractor, generate snippet_data
This commit is contained in:
20
node_modules/mdast-util-to-string/index.js
generated
vendored
Normal file
20
node_modules/mdast-util-to-string/index.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = toString
|
||||
|
||||
// Get the text content of a node. If the node itself does not expose
|
||||
// plain-text fields, `toString` will recursivly try its children.
|
||||
function toString(node) {
|
||||
return (
|
||||
valueOf(node) ||
|
||||
(node.children && node.children.map(toString).join('')) ||
|
||||
''
|
||||
)
|
||||
}
|
||||
|
||||
// Get the value of `node`. Checks, `value`, `alt`, and `title`, in that order.
|
||||
function valueOf(node) {
|
||||
return (
|
||||
(node && node.value ? node.value : node.alt ? node.alt : node.title) || ''
|
||||
)
|
||||
}
|
||||
22
node_modules/mdast-util-to-string/license
generated
vendored
Normal file
22
node_modules/mdast-util-to-string/license
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 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.
|
||||
110
node_modules/mdast-util-to-string/package.json
generated
vendored
Normal file
110
node_modules/mdast-util-to-string/package.json
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
{
|
||||
"_from": "mdast-util-to-string@^1.0.5",
|
||||
"_id": "mdast-util-to-string@1.0.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-868pp48gUPmZIhfKrLbaDneuzGiw3OTDjHc5M1kAepR2CWBJ+HpEsm252K4aXdiP5coVZaJPOqGtVU6Po8xnXg==",
|
||||
"_location": "/mdast-util-to-string",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "mdast-util-to-string@^1.0.5",
|
||||
"name": "mdast-util-to-string",
|
||||
"escapedName": "mdast-util-to-string",
|
||||
"rawSpec": "^1.0.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gatsby-transformer-remark",
|
||||
"/mdast-util-toc"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.0.6.tgz",
|
||||
"_shasum": "7d85421021343b33de1552fc71cb8e5b4ae7536d",
|
||||
"_spec": "mdast-util-to-string@^1.0.5",
|
||||
"_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/mdast-util-to-string/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Titus Wormer",
|
||||
"email": "tituswormer@gmail.com",
|
||||
"url": "https://wooorm.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Utility to get the plain text content of a node",
|
||||
"devDependencies": {
|
||||
"browserify": "^16.0.0",
|
||||
"nyc": "^14.0.0",
|
||||
"prettier": "^1.0.0",
|
||||
"remark-cli": "^6.0.0",
|
||||
"remark-preset-wooorm": "^5.0.0",
|
||||
"tape": "^4.4.0",
|
||||
"tinyify": "^2.0.0",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/syntax-tree/mdast-util-to-string#readme",
|
||||
"keywords": [
|
||||
"mdast",
|
||||
"markdown",
|
||||
"node",
|
||||
"to",
|
||||
"string",
|
||||
"util",
|
||||
"utility"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "mdast-util-to-string",
|
||||
"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/mdast-util-to-string.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"build-bundle": "browserify . -s mdastUtilToString > mdast-util-to-string.js",
|
||||
"build-mangle": "browserify . -s mdastUtilToString -p tinyify > mdast-util-to-string.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.0.6",
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"ignore": [
|
||||
"mdast-util-to-string.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
115
node_modules/mdast-util-to-string/readme.md
generated
vendored
Normal file
115
node_modules/mdast-util-to-string/readme.md
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
# mdast-util-to-string
|
||||
|
||||
[![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]
|
||||
|
||||
[**mdast**][mdast] utility to get the plain text content of a node.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install mdast-util-to-string
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var unified = require('unified')
|
||||
var parse = require('remark-parse')
|
||||
var toString = require('mdast-util-to-string')
|
||||
|
||||
var tree = unified()
|
||||
.use(parse)
|
||||
.parse('Some _emphasis_, **importance**, and `code`.')
|
||||
|
||||
console.log(toString(tree)) // => 'Some emphasis, importance, and code.'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `toString(node)`
|
||||
|
||||
Get the text content of a [node][].
|
||||
|
||||
The algorithm checks `value` of `node`, then `alt`, and finally `title`.
|
||||
If no value is found, the algorithm checks the children of `node` and joins them
|
||||
(without spaces or newlines).
|
||||
|
||||
> This is not a markdown to plain-text library.
|
||||
> Use [`strip-markdown`][strip-markdown] for that.
|
||||
|
||||
## Related
|
||||
|
||||
* [`nlcst-to-string`](https://github.com/syntax-tree/nlcst-to-string)
|
||||
— Get text content in NLCST
|
||||
* [`hast-util-to-string`](https://github.com/wooorm/rehype-minify/tree/master/packages/hast-util-to-string)
|
||||
— Get text content in HAST
|
||||
* [`hast-util-from-string`](https://github.com/wooorm/rehype-minify/tree/master/packages/hast-util-from-string)
|
||||
— Set text content in HAST
|
||||
|
||||
## 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/mdast-util-to-string.svg
|
||||
|
||||
[build]: https://travis-ci.org/syntax-tree/mdast-util-to-string
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-string.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/mdast-util-to-string
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-to-string.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/mdast-util-to-string
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/mdast-util-to-string.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=mdast-util-to-string
|
||||
|
||||
[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
|
||||
|
||||
[mdast]: https://github.com/syntax-tree/mdast
|
||||
|
||||
[node]: https://github.com/syntax-tree/mdast#nodes
|
||||
|
||||
[strip-markdown]: https://github.com/remarkjs/strip-markdown
|
||||
Reference in New Issue
Block a user