readme
This commit is contained in:
parent
84d6243b2c
commit
3aa03d381f
20
readme.md
20
readme.md
@ -16,6 +16,18 @@ These are the primary projects used to render various types of content:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Install from npm
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Update project npm config to refer to correct registry for the @doc-utils scope
|
||||||
|
echo '@doc-utils:registry=https://gitea.jbrumond.me/api/packages/doc-utils/npm/' >> ./.npmrc
|
||||||
|
|
||||||
|
# Install package
|
||||||
|
npm install --save @doc-utils/markdown2html
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Building from source
|
## Building from source
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -27,7 +39,7 @@ npm run tsc
|
|||||||
## Programatic Use
|
## Programatic Use
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { MarkdownOptions, render_markdown_to_html } from './build';
|
import { MarkdownOptions, render_markdown_to_html } from '@doc-utils/markdown2html';
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const options: MarkdownOptions = {
|
const options: MarkdownOptions = {
|
||||||
@ -41,7 +53,7 @@ async function main() {
|
|||||||
### Handling Frontmatter
|
### Handling Frontmatter
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { process_frontmatter } from './build';
|
import { process_frontmatter } from '@doc-utils/markdown2html';
|
||||||
|
|
||||||
const raw_content = `---
|
const raw_content = `---
|
||||||
title: Example Markdown with Frontmatter
|
title: Example Markdown with Frontmatter
|
||||||
@ -119,7 +131,7 @@ const options: MarkdownOptions = {
|
|||||||
```ts
|
```ts
|
||||||
// extension.ts
|
// extension.ts
|
||||||
import type { marked } from 'marked';
|
import type { marked } from 'marked';
|
||||||
import type { MarkdownOptions } from './build';
|
import type { MarkdownOptions } from '@doc-utils/markdown2html';
|
||||||
|
|
||||||
export interface MyCustomToken extends marked.Tokens.Generic {
|
export interface MyCustomToken extends marked.Tokens.Generic {
|
||||||
// ...
|
// ...
|
||||||
@ -152,7 +164,7 @@ export function my_extension(renderer: marked.Renderer, options: MarkdownOptions
|
|||||||
|
|
||||||
// main.ts
|
// main.ts
|
||||||
import { my_extension } from './extension';
|
import { my_extension } from './extension';
|
||||||
import { MarkdownOptions, render_markdown_to_html } from './build';
|
import { MarkdownOptions, render_markdown_to_html } from '@doc-utils/markdown2html';
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const options: MarkdownOptions = {
|
const options: MarkdownOptions = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user