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

@ryan-henness-trimble/mini-docs

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ryan-henness-trimble/mini-docs - npm Package Compare versions

Comparing version 0.0.0-beta.15 to 0.0.0-beta.17

docs/custom-index.md

2

dist/bin/mini-docs-cli.js

@@ -18,3 +18,3 @@ #!/usr/bin/env node

const fileSystemStructure = generateFileSystemStructure(options.input, options.input, options.basePath);
generateIndexPage(fileSystemStructure, options.output, options.baseUrlPath).then(() => {
generateIndexPage(options.input, options.output, options.baseUrlPath, fileSystemStructure).then(() => {
console.log(JSON.stringify(fileSystemStructure, null, 4));

@@ -21,0 +21,0 @@ generatePages(fileSystemStructure, options.output, fileSystemStructure, options.baseUrlPath).then(() => {

@@ -38,3 +38,3 @@ "use strict";

const generatePages = (item, outputPath, sidenavContents, basePath) => __awaiter(void 0, void 0, void 0, function* () {
if (item.type === 'file') {
if (item.type === 'file' && item.name !== 'Index') {
if (item.absolutePath.endsWith(models_1.MD_EXTENSION)) {

@@ -62,10 +62,19 @@ const fileContent = yield fs.readFile(item.absolutePath, UTF_8);

// TODO - Create a better index page pattern. This is just a placeholder.
const generateIndexPage = (sidenavContents, outputPath, basePath) => __awaiter(void 0, void 0, void 0, function* () {
const generateIndexPage = (inputDirPath, outputPath, basePath, sidenavContents) => __awaiter(void 0, void 0, void 0, function* () {
if (sidenavContents.type === 'file') {
return;
}
const indexFileExists = fs.existsSync(path_1.default.join(inputDirPath, 'index.md'));
let renderedContent;
if (indexFileExists) {
const indexFileContent = yield fs.readFile(path_1.default.join(inputDirPath, 'index.md'), UTF_8);
renderedContent = marked_1.marked.parse(indexFileContent, { renderer: customRenderers_1.customRenderer });
}
else {
renderedContent = '<h1>Documentation Index</h1><div>Mini Docs Documentation - View docs on the left</div>';
}
const renderedHtml = yield ejs_1.default.renderFile(DOCUMENT_TEMPLATE_PATH, {
title: 'Documentation Index',
sidenavContents: sidenavContents.contents,
content: '<h1>Documentation Index</h1><div>Mini Docs Documentation - View docs on to the left</div>',
content: renderedContent,
basePath: basePath,

@@ -72,0 +81,0 @@ PathHelpers: PathHelpers_1.default

{
"name": "@ryan-henness-trimble/mini-docs",
"version": "0.0.0-beta.15",
"version": "0.0.0-beta.17",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,3 +18,3 @@ #!/usr/bin/env node

const fileSystemStructure = generateFileSystemStructure(options.input, options.input, options.basePath);
generateIndexPage(fileSystemStructure, options.output, options.baseUrlPath).then(() => {
generateIndexPage(options.input, options.output, options.baseUrlPath, fileSystemStructure).then(() => {
console.log(JSON.stringify(fileSystemStructure, null, 4));

@@ -21,0 +21,0 @@ generatePages(fileSystemStructure, options.output, fileSystemStructure, options.baseUrlPath).then(() => {

@@ -27,3 +27,3 @@ import { customRenderer, setupRenderers } from './marked/customRenderers';

const generatePages = async (item: MdDirectory | MdFile, outputPath: string, sidenavContents: MdDirectory, basePath: string): Promise<void> => {
if (item.type === 'file') {
if (item.type === 'file' && item.name !== 'Index') {
if (item.absolutePath.endsWith(MD_EXTENSION)) {

@@ -51,3 +51,3 @@ const fileContent = await fs.readFile(item.absolutePath, UTF_8);

// TODO - Create a better index page pattern. This is just a placeholder.
const generateIndexPage = async (sidenavContents: MdDirectory | MdFile, outputPath: string, basePath: string): Promise<void> => {
const generateIndexPage = async (inputDirPath: string, outputPath: string, basePath: string, sidenavContents: MdDirectory | MdFile): Promise<void> => {
if (sidenavContents.type === 'file') {

@@ -57,6 +57,15 @@ return;

const indexFileExists = fs.existsSync(path.join(inputDirPath, 'index.md'));
let renderedContent ;
if (indexFileExists) {
const indexFileContent = await fs.readFile(path.join(inputDirPath, 'index.md'), UTF_8);
renderedContent = marked.parse(indexFileContent, { renderer: customRenderer });
} else {
renderedContent = '<h1>Documentation Index</h1><div>Mini Docs Documentation - View docs on the left</div>';
}
const renderedHtml = await ejs.renderFile(DOCUMENT_TEMPLATE_PATH, {
title: 'Documentation Index',
sidenavContents: sidenavContents.contents,
content: '<h1>Documentation Index</h1><div>Mini Docs Documentation - View docs on to the left</div>',
content: renderedContent,
basePath: basePath,

@@ -63,0 +72,0 @@ PathHelpers: PathHelpers

Sorry, the diff of this file is not supported yet

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