Skip to content

Commit

Permalink
refactor: rename to mdbox
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 20, 2024
1 parent a89a336 commit e3ae11f
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 41 deletions.
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ️ omark
# mdbox

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
Expand All @@ -25,26 +25,26 @@ Install package:

```sh
# npm
npm install omark
npm install mdbox

# yarn
yarn add omark
yarn add mdbox

# pnpm
pnpm install omark
pnpm install mdbox

# bun
bun install omark
bun install mdbox
```

Import:

```js
// ESM
import { md } from "omark";
import { md } from "mdbox";

// CommonJS
const { md } = require("omark");
const { md } = require("mdbox");
```

<!-- automd:jsdocs src="./src/index" group="render_utils" -->
Expand Down Expand Up @@ -90,10 +90,10 @@ Format a string as a code block.

**Example:**

```js
````js
md.codeBlock('console.log("Hello, World!");', "js");
// => "```js\nconsole.log("Hello, World!");\n```"
```
````

### `heading(text, level)`

Expand Down Expand Up @@ -149,6 +149,7 @@ Render a markdown link.
md.link("https://www.google.com", "Google");
// => "[Google](https://www.google.com)"
```

```js
md.link("https://www.google.com", "Google", { external: true });
// => "<a href="https://www.google.com" title="Google" target="_blank">Google</a>"
Expand All @@ -164,6 +165,7 @@ Render a markdown ordered or unordered list.
md.list(["Item 1", "Item 2", "Item 3"]);
// => "- Item 1\n- Item 2\n- Item 3"
```

```js
md.list(["Item 1", "Item 2", "Item 3"], { ordered: true });
// => "1. Item 1\n2. Item 2\n3. Item 3"
Expand All @@ -188,17 +190,16 @@ Render a markdown table.

```js
md.table({
columns: ["Breed", "Origin", "Size", "Temperament"],
rows: [
["Abyssinian", "Egypt", "Medium", "Active"],
["Aegean", "Greece", "Medium", "Active"],
["American Bobtail", "United States", "Medium", "Active"],
["Applehead Siamese", "Thailand", "Medium", "Active"],
columns: ["Breed", "Origin", "Size", "Temperament"],
rows: [
["Abyssinian", "Egypt", "Medium", "Active"],
["Aegean", "Greece", "Medium", "Active"],
["American Bobtail", "United States", "Medium", "Active"],
["Applehead Siamese", "Thailand", "Medium", "Active"],
],
});
```


<!-- /automd -->

<!-- automd:jsdocs src="./src/parser/index" group="parsing_utils" -->
Expand All @@ -214,7 +215,7 @@ Create parser with [markdown-it](https://github.com/markdown-it/markdown-it).
**Example:**

```ts
import { initMarkdownItParser } from "omark/parser";
import { initMarkdownItParser } from "mdbox/parser";
const parser = await initMarkdownItParser();
const { tree } = parser.parse("# Hello, *world*!");
```
Expand All @@ -228,7 +229,7 @@ Create parser with [md4w](https://github.com/ije/md4w).
**Example:**

```ts
import { initMd4wParser } from "omark/parser";
import { initMd4wParser } from "mdbox/parser";
const parser = await initMd4wParser();
const { tree } = parser.parse("# Hello, *world*!");
```
Expand All @@ -242,12 +243,11 @@ Create parser with [mdast-util-from-markdown](https://github.com/syntax-tree/mda
**Example:**

```ts
import { initMdAstParser } from "omark/parser";
import { initMdAstParser } from "mdbox/parser";
const parser = await initMdAstParser();
const { tree } = parser.parse("# Hello, *world*!");
```


<!-- /automd -->

## Development
Expand All @@ -266,16 +266,16 @@ Published under [MIT License](./LICENSE).

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/omark?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/omark
[npm-downloads-src]: https://img.shields.io/npm/dm/omark?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/omark
[npm-version-src]: https://img.shields.io/npm/v/mdbox?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/mdbox
[npm-downloads-src]: https://img.shields.io/npm/dm/mdbox?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/mdbox

<!-- [codecov-src]: https://img.shields.io/codecov/c/gh/unjs/omark/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/unjs/omark
<!-- [codecov-src]: https://img.shields.io/codecov/c/gh/unjs/mdbox/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/unjs/mdbox
[bundle-src]: https://img.shields.io/bundlephobia/minzip/omark?style=flat&colorA=18181B&colorB=F0DB4F
[bundle-href]: https://bundlephobia.com/result?p=omark -->
[bundle-src]: https://img.shields.io/bundlephobia/minzip/mdbox?style=flat&colorA=18181B&colorB=F0DB4F
[bundle-href]: https://bundlephobia.com/result?p=mdbox -->

[^1]: https://daringfireball.net/projects/markdown/
[^2]: https://spec.commonmark.org/0.31.2/#characters-and-lines
2 changes: 1 addition & 1 deletion build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default defineBuildConfig({
declaration: true,
rollup: { emitCJS: true },
entries: ["src/index", "src/parser"],
externals: ["omark", "mdast-util-from-markdown", "markdown-it"],
externals: ["mdbox", "mdast-util-from-markdown", "markdown-it"],
hooks: {
async "build:before"() {
const { build } = await import("esbuild");
Expand Down
4 changes: 2 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"markdown-it": "https://esm.sh/[email protected]",
"mdast": "https://esm.sh/@types/mdast",
"mdast-util-from-markdown": "https://esm.sh/[email protected]",
"omark/lib/markdown-it": "./lib/markdown-it.mjs",
"omark/lib/mdast": "./lib/mdast.mjs"
"mdbox/lib/markdown-it": "./lib/markdown-it.mjs",
"mdbox/lib/mdast": "./lib/mdast.mjs"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "omark",
"name": "mdbox",
"version": "0.1.0",
"description": "Just simple markdown utils!",
"repository": "unjs/omark",
"repository": "unjs/mdbox",
"license": "MIT",
"sideEffects": false,
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions src/parser/parsers/markdown-it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { Node, ParsedTree, Parser, Type } from "../types";
* @example
*
* ```ts
* import { initMarkdownItParser } from "omark/parser";
* import { initMarkdownItParser } from "mdbox/parser";
* const parser = await initMarkdownItParser();
* const { tree } = parser.parse("# Hello, *world*!");
* ```
Expand All @@ -20,7 +20,7 @@ import type { Node, ParsedTree, Parser, Type } from "../types";
export async function initMarkdownItParser(
options: Options = {},
): Promise<Parser> {
const _markdownit = await import("omark/lib/markdown-it").then(
const _markdownit = await import("mdbox/lib/markdown-it").then(
(r) => r.default || r,
);
const markdownit = _markdownit({
Expand Down
2 changes: 1 addition & 1 deletion src/parser/parsers/md4w.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { mergeStrings } from "../_utils";
* @example
*
* ```ts
* import { initMd4wParser } from "omark/parser";
* import { initMd4wParser } from "mdbox/parser";
* const parser = await initMd4wParser();
* const { tree } = parser.parse("# Hello, *world*!");
* ```
Expand Down
4 changes: 2 additions & 2 deletions src/parser/parsers/mdast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { mergeStrings } from "../_utils";
* @example
*
* ```ts
* import { initMdAstParser } from "omark/parser";
* import { initMdAstParser } from "mdbox/parser";
* const parser = await initMdAstParser();
* const { tree } = parser.parse("# Hello, *world*!");
* ```
Expand All @@ -21,7 +21,7 @@ import { mergeStrings } from "../_utils";
*/
export async function initMdAstParser(opts: Options = {}): Promise<Parser> {
const { fromMarkdown, gfm, gfmFromMarkdown } = await import(
"omark/lib/mdast"
"mdbox/lib/mdast"
);

return {
Expand Down
2 changes: 1 addition & 1 deletion test/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, it, describe } from "vitest";
import { hash } from "ohash";
import { parsers, fixtures, readFixture } from "./parse.shared";

describe("omark:parsers", () => {
describe("mdbox:parsers", () => {
for (const [parserName, { init, options, results }] of Object.entries(
parsers,
)) {
Expand Down
2 changes: 1 addition & 1 deletion test/render.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const renderTests = {
],
} as Record<keyof typeof md, any[][]>;

describe("omark", () => {
describe("mdbox", () => {
for (const [fn, tests] of Object.entries(renderTests)) {
describe(fn, () => {
for (const t of tests) {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"strict": true,
"skipLibCheck": true,
"paths": {
"omark/lib/*": ["./lib/*"]
"mdbox/lib/*": ["./lib/*"]
}
},
"include": ["src"]
Expand Down

0 comments on commit e3ae11f

Please sign in to comment.