New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nuxt/content

Package Overview
Dependencies
Maintainers
4
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxt/content - npm Package Compare versions

Comparing version

to
1.13.0

17

CHANGELOG.md

@@ -6,2 +6,19 @@ # Change Log

# [1.13.0](https://github.com/nuxt/content/compare/@nuxt/content@1.12.0...@nuxt/content@1.13.0) (2021-02-10)
### Bug Fixes
* use top 2 level of nodes to generate toc ([#757](https://github.com/nuxt/content/issues/757)) ([fe4de6b](https://github.com/nuxt/content/commit/fe4de6bf09bb025878975706de4c0a2f8edbd516))
* **test:** update highlighter snapshots ([32f9f8f](https://github.com/nuxt/content/commit/32f9f8fedb1f4a6d849acaa60124bfa9f0545868))
### Features
* use diff-highlight plugin ([#755](https://github.com/nuxt/content/issues/755)) ([3c2186a](https://github.com/nuxt/content/commit/3c2186a9005c37b3b668ff0124aa77f80c989b85))
# [1.12.0](https://github.com/nuxt/content/compare/@nuxt/content@1.11.1...@nuxt/content@1.12.0) (2021-01-29)

@@ -8,0 +25,0 @@

24

package.json
{
"name": "@nuxt/content",
"version": "1.12.0",
"version": "1.13.0",
"repository": "nuxt/content",

@@ -17,8 +17,8 @@ "license": "MIT",

"@lokidb/loki": "^2.1.0",
"@nuxt/types": "^2.14.7",
"@nuxt/types": "^2.14.12",
"@types/js-yaml": "^4.0.0",
"@types/xml2js": "^0.4.7",
"change-case": "^4.1.1",
"chokidar": "^3.4.3",
"consola": "^2.15.0",
"@types/xml2js": "^0.4.8",
"change-case": "^4.1.2",
"chokidar": "^3.5.1",
"consola": "^2.15.3",
"csvtojson": "^2.0.10",

@@ -28,9 +28,9 @@ "defu": "^3.2.2",

"escape-html": "^1.0.3",
"graceful-fs": "^4.2.4",
"graceful-fs": "^4.2.6",
"gray-matter": "^4.0.2",
"hasha": "^5.2.2",
"hookable": "^4.3.1",
"hookable": "^4.4.0",
"html-tags": "^3.1.0",
"js-yaml": "4.0.0",
"mdast-util-to-hast": "^10.0.1",
"mdast-util-to-hast": "^10.1.1",
"mkdirp": "^1.0.4",

@@ -40,3 +40,3 @@ "node-req": "^2.1.2",

"p-queue": "6.6.2",
"prismjs": "^1.22.0",
"prismjs": "^1.23.0",
"property-information": "^5.6.0",

@@ -56,3 +56,3 @@ "rehype-raw": "^5.0.0",

"unist-builder": "^2.0.3",
"ws": "^7.4.0",
"ws": "^7.4.3",
"xml2js": "^0.4.23"

@@ -63,3 +63,3 @@ },

},
"gitHead": "b25d4db9c76f0755a40f38d8c61e0eafb1eea24e"
"gitHead": "54b9016e6726ac04d3e90212b8f2356978193c0f"
}

@@ -9,13 +9,33 @@ const Prism = require('prismjs')

// enable syntax highlighting on diff language
require('prismjs/components/prism-diff')
require('prismjs/plugins/diff-highlight/prism-diff-highlight')
const DIFF_HIGHLIGHT_SYNTAX = /^(diff)-([\w-]+)/i
const prismHighlighter = (rawCode, language, { lineHighlights, fileName }, { h, node }) => {
let lang = language === 'vue' ? 'html' : language
let lang = language
let grammer
// eslint-disable-next-line no-prototype-builtins
const hasPrismHightlight = Prism.languages.hasOwnProperty(lang)
const diffLanguage = language.match(DIFF_HIGHLIGHT_SYNTAX)
if (diffLanguage) {
lang = diffLanguage[2]
grammer = Prism.languages.diff
}
let code = hasPrismHightlight
? Prism.highlight(rawCode, Prism.languages[lang], lang)
lang = lang === 'vue' ? 'html' : lang
if (!grammer) {
grammer = Prism.languages[lang]
}
const highlightLanguage = diffLanguage
? `diff-${lang}`
: lang
let code = grammer
? Prism.highlight(rawCode, grammer, highlightLanguage)
: rawCode
if (!lang || !hasPrismHightlight) {
if (!lang || !grammer) {
lang = 'text'

@@ -22,0 +42,0 @@ code = escapeHtml(code)

@@ -32,2 +32,12 @@ const matter = require('gray-matter')

flattenNode (node, maxDepth = 2, depth = 0) {
if (!Array.isArray(node.children) || depth === maxDepth) {
return [node]
}
return [
node,
...node.children.flatMap(child => this.flattenNode(child, maxDepth, depth + 1))
]
}
/**

@@ -41,3 +51,5 @@ * Generate table of contents

return body.children.filter(node => tocTags.includes(node.tag)).map((node) => {
const children = this.flattenNode(body, 2)
return children.filter(node => tocTags.includes(node.tag)).map((node) => {
const id = node.props.id

@@ -44,0 +56,0 @@