How to use the richtypo function in richtypo

To help you get started, we’ve selected a few richtypo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sapegin / richtypo.js / example / src / index.js View on Github external
.replace(
			/(\xAF)/gm,
			'<span title="Narrow space" class="rule rule-narrow">$1</span>'
		)
		.replace(
			/([“”«»])/gm,
			'<span title="Quote" class="rule rule-quote">$1</span>'
		)
		.replace(
			/(—)/gm,
			'<span title="Em dash" class="rule rule-emdash">$1</span>'
		);

const rt = {
	en: richtypo([enRules, enAmps, highlight]),
	fr: richtypo([frRules, frAmps, highlight]),
	ru: richtypo([ruRules, highlight]),
};

const config = { base: { lang: 'en' } };

const renderMarkdown = createMarkdownRenderer();
const renderTemplate = createTemplateRenderer({ root: __dirname });

let documents = loadSourceFiles(__dirname, ['md'], {
	renderers: { md: renderMarkdown },
});

documents = documents.map(doc =&gt; {
	return {
		...doc,
		pageTitle: rt[doc.language](doc.title),
github sapegin / richtypo.js / example / src / index.js View on Github external
/(\xAF)/gm,
			'<span title="Narrow space" class="rule rule-narrow">$1</span>'
		)
		.replace(
			/([“”«»])/gm,
			'<span title="Quote" class="rule rule-quote">$1</span>'
		)
		.replace(
			/(—)/gm,
			'<span title="Em dash" class="rule rule-emdash">$1</span>'
		);

const rt = {
	en: richtypo([enRules, enAmps, highlight]),
	fr: richtypo([frRules, frAmps, highlight]),
	ru: richtypo([ruRules, highlight]),
};

const config = { base: { lang: 'en' } };

const renderMarkdown = createMarkdownRenderer();
const renderTemplate = createTemplateRenderer({ root: __dirname });

let documents = loadSourceFiles(__dirname, ['md'], {
	renderers: { md: renderMarkdown },
});

documents = documents.map(doc =&gt; {
	return {
		...doc,
		pageTitle: rt[doc.language](doc.title),
		richtypo: rt[doc.language](doc.content),
github sapegin / richtypo.js / example / src / index.js View on Github external
)
		.replace(
			/(\xAF)/gm,
			'<span title="Narrow space" class="rule rule-narrow">$1</span>'
		)
		.replace(
			/([“”«»])/gm,
			'<span title="Quote" class="rule rule-quote">$1</span>'
		)
		.replace(
			/(—)/gm,
			'<span title="Em dash" class="rule rule-emdash">$1</span>'
		);

const rt = {
	en: richtypo([enRules, enAmps, highlight]),
	fr: richtypo([frRules, frAmps, highlight]),
	ru: richtypo([ruRules, highlight]),
};

const config = { base: { lang: 'en' } };

const renderMarkdown = createMarkdownRenderer();
const renderTemplate = createTemplateRenderer({ root: __dirname });

let documents = loadSourceFiles(__dirname, ['md'], {
	renderers: { md: renderMarkdown },
});

documents = documents.map(doc =&gt; {
	return {
		...doc,

richtypo

HTML and Markdown typography enhancer with extensible rules

MIT
Latest version published 7 months ago

Package Health Score

61 / 100
Full package analysis