Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
bench('commonmark', files, (function() {
var commonmark = require('commonmark'),
parser = new commonmark.Parser(),
writer = new commonmark.HtmlRenderer();
return function(text) {
return writer.render(parser.parse(text));
};
})());
} catch (e) {
public $onInit(): void {
this.executionType = 'Task';
if (this.execution || this.loadingExecution) {
return;
}
if (this.metadata && this.metadata.value.comments) {
const parser: Parser = new Parser();
const renderer: HtmlRenderer = new HtmlRenderer();
this.comments = renderer.render(parser.parse(this.metadata.value.comments));
}
if (this.metadata && this.metadata.value.executionType === 'pipeline') {
this.executionType = 'Pipeline';
this.loadingExecution = true;
this.executionService
.getExecution(this.metadata.value.executionId)
.then((execution: IExecution) => (this.execution = execution))
.catch(() => (this.executionNotFound = true))
.finally(() => (this.loadingExecution = false));
}
}
function loadMarkdown (event, fileName, options) {
console.debug('load-markdown', fileName);
if (options != null) {
_autorun = options.autorun;
ui.toggleAutorun.querySelector('input').checked = _autorun;
}
const reader = new commonmark.Parser();
const writer = new commonmark.HtmlRenderer();
readFileAsync(fileName, 'utf8')
.then(text => ({ fileName, text }))
.then(({ fileName, text }) => {
const parsed = reader.parse(text);
const body = document.querySelector('.markdown-body');
_markdown = writer.render(parsed);
showMarkdown();
return { fileName, parsed };
})
.then(({ fileName, parsed }) => {
const walker = parsed.walker();
const chunks = [];
public async componentDidMount() {
const { locale } = this.props;
const infoFolderRelativePath = "assets/md/information";
let folderPath: string = path.join((global as any).__dirname, infoFolderRelativePath);
try {
if (_PACKAGING === "0") {
folderPath = path.join(process.cwd(), "dist", infoFolderRelativePath);
}
const fileContent = await promisify(readFile)(path.join(folderPath, `${locale}.md`), {encoding: "utf8"});
this.parsedMarkdown = (new commonmark.HtmlRenderer()).render((new commonmark.Parser()).parse(fileContent));
} catch (__) {
this.parsedMarkdown = "<h1>There is no information for your language</h1>";
}
this.forceUpdate();
}
constructor(props) {
super(props);
this.renderer = new HtmlRenderer({ safe: true });
this.parser = new Parser();
}
shouldComponentUpdate(nextProps) {
constructor(props: DisplayPackageProps) {
super(props);
this._parser = new Parser();
this._htmlRenderer = new HtmlRenderer();
this.state = {package: undefined};
}
var template = Handlebars.compile(fs.readFileSync(path.join(__dirname, '/template.hbs.html')).toString('utf8'));
/** Build Changelog
*******************************************************************************************/
var changelog = fs.readFileSync(path.join(__dirname, '/../CHANGELOG.md')).toString('utf8');
changelog = (new commonmark.Parser()).parse(changelog);
var walker = changelog.walker();
var event;
var node;
while ((event = walker.next())) {
node = event.node;
if (node.t === 'SetextHeader' && node.level === 1) {
node.level = 3;
}
}
changelog = (new commonmark.HtmlRenderer()).render(changelog);
/** Build Docs
*******************************************************************************************/
var parsed = dox.parseComments(
fs.readFileSync(
path.join(__dirname, '/../lib/queryize.js')
).toString('utf8')
);
parsed = parsed.concat(
dox.parseComments(
fs.readFileSync(
path.join(__dirname, '/../lib/mutators.js')
).toString('utf8')
)
export function md2html(text: string): string {
const parser = new commonmark.Parser({ smart: false });
const renderer = new commonmark.HtmlRenderer({ smart: false, safe: true });
return renderer.render(parser.parse(text));
}
constructor(props) {
super(props);
this.renderer = new HtmlRenderer({ safe: true });
this.parser = new Parser();
}
shouldComponentUpdate(nextProps) {