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

typedoc-plugin-markdown

Package Overview
Dependencies
Maintainers
1
Versions
253
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typedoc-plugin-markdown - npm Package Compare versions

Comparing version 3.13.4 to 3.13.5

1

dist/resources/helpers/comment.d.ts
import { MarkdownTheme } from '../../theme';
export default function (theme: MarkdownTheme): void;
export declare function readFile(file: string): string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readFile = void 0;
const fs = require("fs");
const Handlebars = require("handlebars");
const Path = require("path");
function default_1(theme) {

@@ -42,5 +45,63 @@ Handlebars.registerHelper('comment', function (parts) {

}
return result.join('');
return parseMarkdown(result.join(''), theme);
});
}
exports.default = default_1;
function parseMarkdown(text, theme) {
const includePattern = /\[\[include:([^\]]+?)\]\]/g;
const mediaPattern = /media:\/\/([^ ")\]}]+)/g;
if (theme.includes) {
text = text.replace(includePattern, (_match, path) => {
path = Path.join(theme.includes, path.trim());
if (fs.existsSync(path) && fs.statSync(path).isFile()) {
const contents = readFile(path);
return contents;
}
else {
theme.application.logger.warn('Could not find file to include: ' + path);
return '';
}
});
}
if (theme.mediaDirectory) {
text = text.replace(mediaPattern, (match, path) => {
const fileName = Path.join(theme.mediaDirectory, path);
if (fs.existsSync(fileName) && fs.statSync(fileName).isFile()) {
return Handlebars.helpers.relativeURL('media') + '/' + path;
}
else {
theme.application.logger.warn('Could not find media file: ' + fileName);
return match;
}
});
}
return text;
}
function readFile(file) {
const buffer = fs.readFileSync(file);
switch (buffer[0]) {
case 0xfe:
if (buffer[1] === 0xff) {
let i = 0;
while (i + 1 < buffer.length) {
const temp = buffer[i];
buffer[i] = buffer[i + 1];
buffer[i + 1] = temp;
i += 2;
}
return buffer.toString('ucs2', 2);
}
break;
case 0xff:
if (buffer[1] === 0xfe) {
return buffer.toString('ucs2', 2);
}
break;
case 0xef:
if (buffer[1] === 0xbb) {
return buffer.toString('utf8', 3);
}
}
return buffer.toString('utf8', 0);
}
exports.readFile = readFile;

6

package.json
{
"name": "typedoc-plugin-markdown",
"version": "3.13.4",
"version": "3.13.5",
"description": "A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.",

@@ -17,4 +17,4 @@ "main": "dist/index.js",

"docs": "yarn run build && yarn run docs:md && yarn run docs:html",
"docs:md": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-mdn-links --options ../../test/typedoc-options.json --out ./docs/md",
"docs:html": "typedoc --options ../../test/typedoc-options.json --plugin typedoc-plugin-mdn-links --out ./docs/html"
"docs:md": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-mdn-links --options ../../stub-project/typedoc-options.json --out ./docs/md",
"docs:html": "typedoc --options ../../stub-project/typedoc-options.json --plugin typedoc-plugin-mdn-links --out ./docs/html"
},

@@ -21,0 +21,0 @@ "author": "Thomas Grey",

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