Skip to content

Commit

Permalink
fix: remove code-quote when vertical bar inside table
Browse files Browse the repository at this point in the history
As in bitflight-devops#168 described the quote (grave accent: &bitflight-devops#96;)
should be removed that markdown interprets the
vertical bar (`&bitflight-devops#124;`) correctly.
  • Loading branch information
fty4 committed Aug 11, 2022
1 parent bbb28a0 commit a8df0fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ or use none, and instead use a `.ghadocs.json` file.
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------------- | ------------ |
| **`action`** | The absolute or relative path to the `action.yml` file to read in from. | `action.yml` | **false** |
| **`readme`** | The absolute or relative path to the markdown output file that contains the formatting tokens within it. | `README.md` | **false** |
| **`owner`** | The GitHub Action repository owner. i.e: `bitflight-devops`|`your-gh-username` | | **false** |
| **`owner`** | The GitHub Action repository owner. i.e: bitflight-devops|your-gh-username | | **false** |
| **`repo`** | The GitHub Action repository name. i.e: `github-action-readme-generator` | | **false** |
| **`save`** | Save the provided values in a `.ghadocs.json` file. This will update any existing `.ghadocs.json` file that is in place. | | **false** |
| **`pretty`** | Use `prettier` to pretty print the new README.md file | | **false** |
Expand Down
8 changes: 6 additions & 2 deletions dist/index.cjs

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion src/markdowner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ export function ArrayOfArraysToMarkdownTable(providedTableContent: MarkdownArray
const idx = i > 1 ? i - 1 : 0;
const dataRow = tableContent[idx] as string[];
for (const [j] of row.entries()) {
const content = dataRow[col]?.replace(/\|/g, '&#124;').replace(/\n/, '<br />') ?? '';
let content = dataRow[col]?.replace(/\n/, '<br />') ?? '';
if (content.includes('|')) {
content = content.replace(/\|/g, '&#124;');
content = content.replace(/`/g, '');
}

if (j % 2 === 1) {
if (i === 0) {
(markdownArrays[i] as string[])[j] = ` **${content}** `;
Expand Down

0 comments on commit a8df0fb

Please sign in to comment.