Skip to content

Commit

Permalink
Fix typo.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Nov 14, 2023
1 parent 39f7268 commit 80db5d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions feishu-pages/src/doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ export const fetchDocBody = async (fileDoc: Doc) => {
};

/**
* Generate a Markdown frontmater.
* Generate a Markdown Frontmatter.
* @param doc
* @param urlPath
* @param position
* @returns
*/
export const generateFrontmater = (
export const generateFrontmatter = (
doc: Doc,
urlPath: string,
position: number
Expand Down
4 changes: 2 additions & 2 deletions feishu-pages/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { FileToken } from 'feishu-docx';
import fs from 'fs';
import path from 'path';
import { fetchDocBody, generateFrontmater } from './doc';
import { fetchDocBody, generateFrontmatter } from './doc';
import {
BASE_URL,
DOCS_DIR,
Expand Down Expand Up @@ -99,7 +99,7 @@ const fetchDocAndWriteFile = async (
}
}

const metaInfo = generateFrontmater(doc, doc.slug, doc.position);
const metaInfo = generateFrontmatter(doc, doc.slug, doc.position);

let out = '';
out += metaInfo + '\n\n';
Expand Down
12 changes: 6 additions & 6 deletions feishu-pages/tests/doc.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { describe, test } from '@jest/globals';
import assert from 'node:assert';
import { generateFrontmater } from '../src/doc';
import { generateFrontmatter } from '../src/doc';

describe('Doc', () => {
test('generateFrontmater', () => {
test('generateFrontmatter', () => {
let doc: any = {
title: 'Docs: "hello world"',
};
Expand All @@ -18,7 +18,7 @@ sidebar_position: 1
---
`;

assert.equal(generateFrontmater(doc, urlPath, position), expected);
assert.equal(generateFrontmatter(doc, urlPath, position), expected);

doc = {
title: `Docs: 'Test single quote'`,
Expand All @@ -30,7 +30,7 @@ slug: /hello/world
sidebar_position: 1
---
`;
assert.equal(generateFrontmater(doc, urlPath, position), expected);
assert.equal(generateFrontmatter(doc, urlPath, position), expected);

doc = {
title: null,
Expand All @@ -41,7 +41,7 @@ sidebar_position: 1
---
`;

assert.equal(generateFrontmater(doc, urlPath, position), expected);
assert.equal(generateFrontmatter(doc, urlPath, position), expected);

let doc1 = {
title: null,
Expand All @@ -66,7 +66,7 @@ tools:
`;

assert.equal(
generateFrontmater(
generateFrontmatter(
doc1 as any,
'https://github.com/foo/bar?dar=A+B&key=#hash1',
3
Expand Down

0 comments on commit 80db5d4

Please sign in to comment.