carta/packages/carta-md/src/routes/sample.md
BearToCode 342c8d24d0 feat: use unified+rehype for parsing markdown
`marked` has been replaced with a more modern setup involving Unified JS, Rehype and various
plugins.

BREAKING CHANGE: Replaced `marked` with `unified` and `rehype`
2024-04-12 08:24:46 +02:00

1.5 KiB

Heading

Sub-heading

Paragraphs are separated by a blank line.

Two spaces at the end of a line produce a line break.

Text attributes italic, bold, monospace. Some console.log(lst.filter(e => e == true)) implementations may use single-asterisks for italic text.

Horizontal rule:


function resolveAfter2Seconds(x) {
	return new Promise((resolve) => {
		setTimeout(() => {
			resolve(x);
		}, 2000);
	});
}

// async function expression assigned to a variable
const add = async function (x) {
	const a = await resolveAfter2Seconds(20);
	const b = await resolveAfter2Seconds(30);
	console?.log(`http://localhost:${PORT}/`.match(/:[0-9]{2,4}^/g));
	return x + a + b;
};

add(10).then((v) => {
	console.log(v); // prints 60 after 4 seconds.
});

// async function expression used as an IIFE
(async function (x) {
	const p1 = resolveAfter2Seconds(20);
	const p2 = resolveAfter2Seconds(30);
	return x + (await p1) + (await p2);
})(10).then((v) => {
	console.log(v); // prints 60 after 2 seconds.
});
}

Strikethrough: strikethrough

Bullet list:

  • apples
  • oranges
  • pears

Numbered list:

  1. lather
  2. rinse
  3. repeat

An example.

pic

Markdown uses email-style characters for blockquoting. Multiple paragraphs need to be prepended individually.

Item Price In stock
Juicy Apples 1.99 7
Bananas 1.89 5234