Markdown Content
blog.ts
import const MarkdownIt: MarkdownItConstructorMain parser/renderer class.
Usage
// node.js, "classic" way:
var MarkdownIt = require('markdown-it'),
    md = new MarkdownIt();
var result = md.render('# markdown-it rulezz!');
// node.js, the same, but with sugar:
var md = require('markdown-it')();
var result = md.render('# markdown-it rulezz!');
// browser without AMD, added to "window" on script load
// Note, there are no dash.
var md = window.markdownit();
var result = md.render('# markdown-it rulezz!');
Single line rendering, without paragraph wrap:
var md = require('markdown-it')();
var result = md.renderInline('__markdown-it__ rulezz!');
Example
// commonmark mode
var md = require('markdown-it')('commonmark');
// default mode
var md = require('markdown-it')();
// enable everything
var md = require('markdown-it')({
  html: true,
  linkify: true,
  typographer: true
});
Syntax highlighting
var hljs = require('highlight.js') // https://highlightjs.org/
var md = require('markdown-it')({
  highlight: function (str, lang) {
    if (lang && hljs.getLanguage(lang)) {
      try {
        return hljs.highlight(lang, str, true).value;
      } catch (__) {}
    }
    return ''; // use external default escaping
  }
});
Or with full wrapper override (if you need assign class to <pre>):
var hljs = require('highlight.js') // https://highlightjs.org/
// Actual default values
var md = require('markdown-it')({
  highlight: function (str, lang) {
    if (lang && hljs.getLanguage(lang)) {
      try {
        return '<pre class="hljs"><code>' +
               hljs.highlight(lang, str, true).value +
               '</code></pre>';
      } catch (__) {}
    }
    return '<pre class="hljs"><code>' + md.utils.escapeHtml(str) + '</code></pre>';
  }
});
MarkdownIt from 'markdown-it';
var console: ConsoleThe console module provides a simple debugging console that is similar to the
JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A Consoleclass with methods such asconsole.log(),console.error()andconsole.warn()that can be used to write to any Node.js stream.
- A global consoleinstance configured to write toprocess.stdoutandprocess.stderr. The globalconsolecan be used without callingrequire('console').
Warning: The global console object's methods are neither consistently
synchronous like the browser APIs they resemble, nor are they consistently
asynchronous like all other Node.js streams. See the note on process I/O for
more information.
Example using the global console:
console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr
Example using the Console class:
const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
console.Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)Prints to stdout with newline. Multiple arguments can be passed, with the
first used as the primary message and all additional used as substitution
values similar to printf(3) (the arguments are all passed to util.format()).
const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout
See util.format() for more information.
log(1);
var console: ConsoleThe console module provides a simple debugging console that is similar to the
JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A Consoleclass with methods such asconsole.log(),console.error()andconsole.warn()that can be used to write to any Node.js stream.
- A global consoleinstance configured to write toprocess.stdoutandprocess.stderr. The globalconsolecan be used without callingrequire('console').
Warning: The global console object's methods are neither consistently
synchronous like the browser APIs they resemble, nor are they consistently
asynchronous like all other Node.js streams. See the note on process I/O for
more information.
Example using the global console:
console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3
const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr
Example using the Console class:
const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);
myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
console.Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)Prints to stdout with newline. Multiple arguments can be passed, with the
first used as the primary message and all additional used as substitution
values similar to printf(3) (the arguments are all passed to util.format()).
const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout
See util.format() for more information.
log(2);
blog.ts
import { function rendererRich(options?: RendererRichOptions): TwoslashRendererAn alternative renderer that providers better prefixed class names,
with syntax highlight for the info text.
rendererRich, function transformerTwoslash(options?: TransformerTwoslashIndexOptions): _shikijs_core_dist_chunk_tokens_mjs.AFactory function to create a Shiki transformer for twoslash integrations.
transformerTwoslash } from '@shikijs/twoslash';
function transformerTwoslash(options?: TransformerTwoslashIndexOptions | undefined): ShikiTransformerFactory function to create a Shiki transformer for twoslash integrations.
transformerTwoslash({
  TransformerTwoslashOptions.renderer?: TwoslashRenderer | undefinedCustom renderers to decide how each info should be rendered
renderer: function rendererRich(options?: RendererRichOptions | undefined): TwoslashRendererAn alternative renderer that providers better prefixed class names,
with syntax highlight for the info text.
rendererRich(), // <--
});
import {
  function transformerNotationDiff(options?: TransformerNotationDiffOptions): ShikiTransformerUse [!code ++] and [!code --] to mark added and removed lines.
transformerNotationDiff,
  // ...
} from '@shikijs/transformers';
const const code: "console.log('hello')"code = `console.log('hello')`;console.log(1);
console.log(1);
console.log(1);
console.log(1);
console.log(1);console.log(1);
console.log(1);
console.log(1);#Heading 2
#Heading 3
#Heading 4
#Heading 5
#Heading 6
 npm install @nuxtjs/html-validator --save-dev yarn add @nuxtjs/html-validator --dev pnpm i -D @nuxtjs/html-validator bun install @nuxtjs/html-validator --save-dev
const a = 2;const a: number = 2;- Block space
function block() {
  space();
  if (true) {
    table();
  }
}- Word highlight
const const obj: {
    boo: number;
    bar: () => number;
    baz: string;
}obj = {
  boo: numberboo: 1,
  bar: () => numberbar: () => 2,
  baz: stringbaz: 'string',
};
const obj: {
    boo: number;
    bar: () => number;
    baz: string;
}obj.b- bar
- baz
- boo
boo: numberoo;
import { function getHighlighterCore(options?: HighlighterCoreOptions): Promise<HighlighterCore>getHighlighterCore } from '@shikijs/core';
const const highlighter: HighlighterCorehighlighter = await function getHighlighterCore(options?: HighlighterCoreOptions<false> | undefined): Promise<HighlighterCore>getHighlighterCore({});
const str: string = 1;str = 'Hello';const const a: 1a = 1;Custom log messageconst const b: 1b = 1;Custom error messageconst const c: 1c = 1;Custom warning messageconst const d: 1d = 1;Custom annotation messagevar Number: NumberConstructorAn object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.
Number.p- parseFloat
- parseInt
- prototype
NumberConstructor.parseInt(string: string, radix?: number | undefined): numberConverts A string to an integer.
arseInt('123', 10);
- Block space
function block() {
  space();
  if (true) {
    table();
  }
}- Word highlight
export function foo() {
  const msg = 'Hello World';
  console.log(msg); // prints Hello World
}const options = { foo: 'bar' };
options.foo = 'baz';
console.log(options.foo); // this one will not be highlighted