Skip to content

Commit

Permalink
chore: rename content to body (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatiusmb committed Jan 12, 2024
1 parent f09d08a commit 2166c59
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion workspace/marqua/src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function parse(source) {
const stuffed = inject(crude, memory);

return {
content: stuffed,
body: stuffed,
metadata: Object.assign(memory, {
/** estimated reading time */
get estimate() {
Expand Down
4 changes: 2 additions & 2 deletions workspace/marqua/src/core/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ something here
});

suites['parse/']('parse markdown contents', () => {
const { content, metadata } = core.parse(
const { body, metadata } = core.parse(
`
---
title: Hello Parser
Expand All @@ -367,7 +367,7 @@ Welcome to the contents
table: [],
});

assert.equal(content.trim(), 'Welcome to the contents');
assert.equal(body.trim(), 'Welcome to the contents');
});

Object.values(suites).forEach((v) => v.run());
4 changes: 2 additions & 2 deletions workspace/marqua/src/fs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { parse } from '../core/index.js';
* @returns {Output & import('../types.js').Metadata & { content: string }}
*/
export function compile(entry) {
const { content, metadata } = parse(fs.readFileSync(entry, 'utf-8'));
const result = { ...metadata, content: marker.render(content) };
const { body, metadata } = parse(fs.readFileSync(entry, 'utf-8'));
const result = { ...metadata, content: marker.render(body) };
return /** @type {any} */ (result);
}

Expand Down
8 changes: 4 additions & 4 deletions workspace/marqua/test/apps/multiple/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const target = `${process.cwd()}/test/apps/multiple`;

basics.standard('standard traversal', () => {
const output = traverse({ entry: `${target}/standard/input` }, ({ buffer, marker, parse }) => {
const { content, metadata } = parse(buffer.toString('utf-8'));
return { ...metadata, content: marker.render(content) };
const { body, metadata } = parse(buffer.toString('utf-8'));
return { ...metadata, content: marker.render(body) };
});
const expected = readJSON(`${target}/standard/expected.json`);

Expand All @@ -27,8 +27,8 @@ basics.depth('depth traversal', () => {
const output = traverse(
{ entry: `${target}/depth/input`, depth: 1 },
({ buffer, marker, parse }) => {
const { content, metadata } = parse(buffer.toString('utf-8'));
return { ...metadata, content: marker.render(content) };
const { body, metadata } = parse(buffer.toString('utf-8'));
return { ...metadata, content: marker.render(body) };
},
);
const expected = readJSON(`${target}/depth/expected.json`);
Expand Down
4 changes: 2 additions & 2 deletions workspace/website/src/routes/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const load: import('./$types').PageServerLoad = async () => {
({ breadcrumb: [filename], buffer, marker, parse }) => {
const path = `workspace/content/${filename}`;
const slug = filename.match(/^(\d{2})-(.+).md$/)![2];
const { content, metadata } = parse(buffer.toString('utf-8'));
return { slug, title: metadata.title, path, content: marker.render(content) };
const { body, metadata } = parse(buffer.toString('utf-8'));
return { slug, title: metadata.title, path, content: marker.render(body) };
},
);

Expand Down

1 comment on commit 2166c59

@vercel
Copy link

@vercel vercel bot commented on 2166c59 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.