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

@antora/navigation-builder

Package Overview
Dependencies
Maintainers
2
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antora/navigation-builder - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

37

lib/build-navigation.js

@@ -51,3 +51,3 @@ 'use strict'

return lists.map((list, idx) => {
const tree = buildNavigationTree(list.getTitle(), list)
const tree = buildNavigationTree(list.getTitle(), list.getItems())
tree.root = true

@@ -59,19 +59,30 @@ tree.order = idx ? parseFloat((index + idx / lists.length).toFixed(4)) : index

function getChildList (node) {
let candidate = node.getBlocks()[0]
let context
if (
candidate &&
((context = candidate.getContext()) === 'ulist' ||
(context === 'open' && (candidate = candidate.getBlocks()[0]) && candidate.getContext() === 'ulist'))
) {
return candidate
function getChildListItems (listItem) {
const blocks = listItem.getBlocks()
const candidate = blocks[0]
if (candidate) {
if (blocks.length === 1 && candidate.getContext() === 'ulist') {
return candidate.getItems()
} else {
let context
return blocks.reduce((accum, block) => {
if (
(context = block.getContext()) === 'ulist' ||
(context === 'open' && (block = block.getBlocks()[0]) && block.getContext() === 'ulist')
) {
accum.push(...block.getItems())
}
return accum
}, [])
}
} else {
return []
}
}
function buildNavigationTree (formattedContent, list) {
function buildNavigationTree (formattedContent, items) {
const entry = formattedContent ? partitionContent(formattedContent) : {}
if (list) {
entry.items = list.getItems().map((item) => buildNavigationTree(item.getText(), getChildList(item)))
if (items.length) {
entry.items = items.map((item) => buildNavigationTree(item.getText(), getChildListItems(item)))
}

@@ -78,0 +89,0 @@

{
"name": "@antora/navigation-builder",
"version": "1.0.2",
"version": "1.0.3",
"description": "Builds a navigation catalog from navigation files for adding site navigation to pages in an Antora documentation pipeline.",

@@ -18,3 +18,3 @@ "license": "MPL-2.0",

"dependencies": {
"@antora/asciidoc-loader": "1.0.2"
"@antora/asciidoc-loader": "1.0.3"
},

@@ -21,0 +21,0 @@ "engines": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc