Skip to content

Commit

Permalink
refactor: removed features that are virtually unnecessary on build th…
Browse files Browse the repository at this point in the history
…e Markdown
  • Loading branch information
kurone-kito committed May 22, 2021
1 parent 803e378 commit 74d7f52
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 25 deletions.
19 changes: 5 additions & 14 deletions packages/dantalion-i18n/src/build/article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ import { line } from './list';

/** The options for the `article` function. */
export interface Options {
/**
* The body text.
*
* If this value is an array, it will be rendered multiple lines,
* one element at a line.
*/
readonly body?: string | readonly (string | undefined)[];
/** The body text. */
readonly body?: string;
/** The heading text. */
readonly head?: string;
readonly head: string;
/**
* The heading level.
*
Expand All @@ -23,9 +18,5 @@ export interface Options {
* Create the Markdown from the heading and body pair.
* @param options The options.
*/
export default ({ body = '', head = '', level = 1 }: Options = {}): string =>
line(
`${'#'.repeat(level)} ${head}`.trim(),
'',
(typeof body === 'string' ? body : line(...body)).trim()
);
export default ({ body = '', head, level = 1 }: Options): string =>
line(`${'#'.repeat(level)} ${head}`.trim(), '', body.trim());
2 changes: 1 addition & 1 deletion packages/dantalion-i18n/src/build/genius.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const createFromGenius =
* @param source The source.
* @param level The heading level.
*/
(source: PersonalityType, level = 1): string =>
(source: PersonalityType, level: number): string =>
line(
fromGeniusOnlySummary(source, level),
fromGeniusOnlyDesctiption(descriptions, source, level + 1)
Expand Down
10 changes: 0 additions & 10 deletions packages/dantalion-i18n/src/build/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,3 @@ export const list = createListFunc('- ');

/** Create the Markdown from the array string. */
export const order = createListFunc('1. ');

/**
* Create the Markdown from the array string.
* @param source The array string.
* @param prefix The prefix string of each line.
*
* If omitted, its default value is "`- `".
*/
export default (source: readonly string[] = [], prefix = '- '): string =>
createListFunc(prefix)(...source);

0 comments on commit 74d7f52

Please sign in to comment.