Skip to content

Commit

Permalink
feat: Add "title" to Github Action (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Feb 1, 2024
1 parent abb0779 commit b4b4bda
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ $ npm i markdown-to-html-cli
- `markdown-style` - Markdown 包裹样式修改.
- `markdown-style-theme` - 设置 Markdown 风格的浅色/深色主题。
- `style` - 覆盖默认样式。 css 文件路径或 css 字符串
- `title` - 定义 `<title>` 文档标题的内容!

### Output Parameters

Expand Down
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,17 @@ inputs:
description: Markdown wrapper style
default: ''
required: false

style:
description: Override default styles. css file path or css string
default: ''
required: false

title:
description: Define the content of the "<title>" document title!
default: ''
required: false

outputs:
output:
description: Output static pages to the specified directory
Expand Down
7 changes: 6 additions & 1 deletion packages/action/src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Options, formatConfig, create } from 'markdown-to-html-cli';
const darkMode = getInput('dark-mode');
const markdownStyle = getInput('markdown-style');
const style = getInput('style');
const title = getInput('title');
const markdownStyleTheme = getInput('markdown-style-theme');
const options: Options = {
document: { meta: [], link: [], style: [] }
Expand Down Expand Up @@ -58,10 +59,14 @@ import { Options, formatConfig, create } from 'markdown-to-html-cli';
}
}

if (title) {
options['title'] = title;
}

startGroup(`Options: \x1b[34m(Action Inputs)\x1b[0m`);
info(`${JSON.stringify(options, null, 2)}`);
endGroup();

const opts = formatConfig({
...options, 'dark-mode': darkMode, 'markdown-style-theme': markdownStyleTheme,
});
Expand Down
1 change: 1 addition & 0 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ $ npm i markdown-to-html-cli
- `markdown-style` - Markdown wrapper style.
- `markdown-style-theme` - Setting markdown-style light/dark theme. (`dark | light`)
- `style` - Override default styles. css file path or css string
- `title` - Define the content of the "<title>" document title!

### Output Parameters

Expand Down

0 comments on commit b4b4bda

Please sign in to comment.