Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mscharley/api-documenter-hugo

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mscharley/api-documenter-hugo - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

4

dist/cli/HugoAction.js

@@ -10,4 +10,4 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.

summary: 'Generate documentation as Markdown files (*.md) compatible with Hugo',
documentation: 'Generates API documentation as a collection of files in'
+ ' Markdown format, suitable for example for publishing using the hugo static site generator.',
documentation: 'Generates API documentation as a collection of files in' +
' Markdown format, suitable for example for publishing using the hugo static site generator.',
});

@@ -14,0 +14,0 @@ }

@@ -70,2 +70,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.

break;
case ApiItemKind.EntryPoint: {
// TODO: Skip the root entrypoint as the package already writes this file
if (apiItem.importPath === '') {
return;
}
const unscopedPackageName = PackageName.getUnscopedName(apiItem.parent.displayName);
frontMatter.title = `${unscopedPackageName}/${apiItem.displayName} entrypoint`;
break;
}
case ApiItemKind.Enum:

@@ -199,2 +208,6 @@ frontMatter.title = `${scopedName} enum`;

break;
case ApiItemKind.EntryPoint:
// TODO: Actually document entrypoints correctly
output.appendNodeInParagraph(new DocPlainText({ configuration, text: 'TODO: Please reference the root entrypoint which contains links to elements from all entrypoints' }));
break;
case ApiItemKind.Package:

@@ -413,2 +426,27 @@ this._writePackageOrNamespaceTables(output, apiItem);

});
if (apiContainer.kind === ApiItemKind.Package) {
const entrypointsTable = new DocTable({
configuration,
headerTitles: ['Path'],
});
for (const entrypoint of apiContainer.entryPoints) {
const path = new DocTableCell({ configuration }, [
new DocParagraph({ configuration }, [
new DocLinkTag({
configuration,
tagName: '@link',
linkText: `${apiContainer.name}${entrypoint.importPath === '' ? '' : `/${entrypoint.importPath}`}`,
urlDestination: this._getLinkFilenameForApiItem(entrypoint),
}),
]),
]);
entrypointsTable.addRow(new DocTableRow({ configuration }, [path]));
this._writeApiItemPage(entrypoint);
}
// There will always be at least one entrypoint, but we only need a table if there is more than the root
if (entrypointsTable.rows.length > 1) {
output.appendNode(new DocHeading({ configuration, title: 'Entrypoints' }));
output.appendNode(entrypointsTable);
}
}
const apiMembers = apiContainer.kind === ApiItemKind.Package

@@ -979,3 +1017,3 @@ ? apiContainer.entryPoints.flatMap((ep) => ep.members)

else {
baseName += '/_';
baseName += '/_root';
}

@@ -985,3 +1023,7 @@ break;

case ApiItemKind.Package:
baseName = `${Utilities.getSafeFilenameForName(PackageName.getUnscopedName(hierarchyItem.displayName))}/_`;
baseName = Utilities.getSafeFilenameForName(PackageName.getUnscopedName(hierarchyItem.displayName));
if (hierarchyItem === apiItem) {
// If we're generating a link to the package, then we should refer to the default entrypoint instead.
baseName += '/_root';
}
break;

@@ -988,0 +1030,0 @@ default:

@@ -11,5 +11,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.

const myPackageVersion = PackageJsonLookup.loadOwnPackageJson(__dirname).version;
console.log(os.EOL
+ Colorize.bold(`api-documenter-hugo ${myPackageVersion} ${Colorize.cyan('- https://github.com/mscharley/api-documenter-hugo')}${os.EOL}`));
console.log(os.EOL +
Colorize.bold(`api-documenter-hugo ${myPackageVersion} ${Colorize.cyan(' - https://github.com/mscharley/api-documenter-hugo')}${os.EOL}`));
const parser = new ApiDocumenterCommandLine();
parser.execute().catch(console.error); // CommandLineParser.execute() should never reject the promise
{
"name": "@mscharley/api-documenter-hugo",
"version": "1.0.4",
"version": "1.0.5",
"description": "",

@@ -5,0 +5,0 @@ "type": "module",

@@ -135,2 +135,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.

break;
case ApiItemKind.EntryPoint: {
// TODO: Skip the root entrypoint as the package already writes this file
if ((apiItem as ApiEntryPoint).importPath === '') {
return;
}
const unscopedPackageName: string = PackageName.getUnscopedName((apiItem.parent as ApiPackage).displayName);
frontMatter.title = `${unscopedPackageName}/${apiItem.displayName} entrypoint`;
break;
}
case ApiItemKind.Enum:

@@ -286,2 +295,6 @@ frontMatter.title = `${scopedName} enum`;

break;
case ApiItemKind.EntryPoint:
// TODO: Actually document entrypoints correctly
output.appendNodeInParagraph(new DocPlainText({ configuration, text: 'TODO: Please reference the root entrypoint which contains links to elements from all entrypoints' }));
break;
case ApiItemKind.Package:

@@ -548,2 +561,30 @@ this._writePackageOrNamespaceTables(output, apiItem as ApiPackage);

if (apiContainer.kind === ApiItemKind.Package) {
const entrypointsTable = new DocTable({
configuration,
headerTitles: ['Path'],
});
for (const entrypoint of (apiContainer as ApiPackage).entryPoints) {
const path = new DocTableCell({ configuration }, [
new DocParagraph({ configuration }, [
new DocLinkTag({
configuration,
tagName: '@link',
linkText: `${apiContainer.name}${entrypoint.importPath === '' ? '' : `/${entrypoint.importPath}`}`,
urlDestination: this._getLinkFilenameForApiItem(entrypoint),
}),
]),
]);
entrypointsTable.addRow(new DocTableRow({ configuration }, [path]));
this._writeApiItemPage(entrypoint);
}
// There will always be at least one entrypoint, but we only need a table if there is more than the root
if (entrypointsTable.rows.length > 1) {
output.appendNode(new DocHeading({ configuration, title: 'Entrypoints' }));
output.appendNode(entrypointsTable);
}
}
const apiMembers: ReadonlyArray<ApiItem>

@@ -1255,3 +1296,3 @@ = apiContainer.kind === ApiItemKind.Package

} else {
baseName += '/_';
baseName += '/_root';
}

@@ -1261,3 +1302,7 @@ break;

case ApiItemKind.Package:
baseName = `${Utilities.getSafeFilenameForName(PackageName.getUnscopedName(hierarchyItem.displayName))}/_`;
baseName = Utilities.getSafeFilenameForName(PackageName.getUnscopedName(hierarchyItem.displayName));
if (hierarchyItem === apiItem) {
// If we're generating a link to the package, then we should refer to the default entrypoint instead.
baseName += '/_root';
}
break;

@@ -1264,0 +1309,0 @@ default:

Sorry, the diff of this file is not supported yet

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