diff --git a/README.md b/README.md index 07ea92e..ed6f426 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,21 @@ Converts markdown files to HTML -Check action.yml for docs. +## Usage -Detailed readme coming soon. +```yml +- name: Convert index.md to index.html + uses: jd-solanki/gh-action-md-to-html@v1.3.0 + with: + files: '[["index.md", "index.html"]]' + theme: 'dark' # Optional, default: auto + title: 'My Website' # Optional, If title isn't provided title tag won't get added + favicon: 'https://github.githubassets.com/favicons/favicon-dark.png' # Optional, If favicon isn't provided favicon's link tag won't get added +``` + +## ToDo + +- [ ] Fetch title from repo name if isn't provided (PR welcome) ## Credits diff --git a/action.yml b/action.yml index bcb0bf1..ddd39c7 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,13 @@ inputs: debug: description: Boolean value which will tell action to log the action it performs. Useful for debugging. default: false + title: + description: 'Title of the HTML page' + # TODO: Get it from repo name + required: false + favicon: + description: 'Favicon of the HTML page' + required: false runs: using: 'node16' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index 2d2dd91..3792d75 100644 --- a/dist/index.js +++ b/dist/index.js @@ -12949,7 +12949,7 @@ const md = new MarkdownIt({ html: true, }) -async function mdToHtml(filePath, debug, theme) { +async function mdToHtml(filePath, debug, theme, options) { // Read source file const content = await fs.readFile(filePath, 'utf8') if (debug) core.info(`content of ${filePath}: ${content}`) @@ -12957,11 +12957,16 @@ async function mdToHtml(filePath, debug, theme) { // converted to HTML const rendered = md.render(content) + const titleTag = options.title ? `