Skip to content

Commit

Permalink
Slack markdown fixes (#29)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Sieradski <[email protected]>
  • Loading branch information
selfagency authored Mar 21, 2022
1 parent 116b9e2 commit f4fa9e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
key: feed-cache-${{ steps.generate-key.outputs.cache-key }}
restore-keys: feed-cache-
- name: NYT
uses: 'selfagency/[email protected].7'
uses: 'selfagency/[email protected].8'
with:
rss: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
Expand All @@ -79,7 +79,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: NYT
uses: 'selfagency/[email protected].7'
uses: 'selfagency/[email protected].8'
with:
rss: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
Expand Down Expand Up @@ -110,13 +110,13 @@ jobs:
key: feed-cache-${{ steps.generate-key.outputs.cache-key }}
restore-keys: feed-cache-
- name: LAT
uses: 'selfagency/[email protected].7'
uses: 'selfagency/[email protected].8'
with:
rss: 'https://www.latimes.com/rss2.0.xml'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
cache_dir: './slackfeedbot-cache'
- name: WaPo
uses: 'selfagency/[email protected].7'
uses: 'selfagency/[email protected].8'
with:
rss: 'https://feeds.washingtonpost.com/rss/homepage'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30134,7 +30134,7 @@ var genPayload = async (filtered, unfiltered, rssFeed, unfurl, showDesc, showImg
const { document: document2 } = parseHTML("<div></div>");
const desc = (0, import_striptags.default)(item.description.replace(/&gt;/g, ">").replace(/&lt;/g, "<"), ["p", "strong", "b", "em", "i", "a", "ul", "ol", "li"], " ");
const markdown = converter.makeMarkdown(desc, document2);
text += `${markdown.replace(/\\-/g, "-").replace(/\\\|/g, "|")}`;
text += `${markdown.replace(/\\-/g, "-").replace(/\\\|/g, "|").replace(/\*{2}/g, "*").replace(/\[(.+)\]\((.+)\)/g, "<$2|$1>")}`;
}
}
if (item == null ? void 0 : item.title) {
Expand Down
7 changes: 6 additions & 1 deletion src/lib/payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ const genPayload = async (
' '
);
const markdown = converter.makeMarkdown(desc, document);
text += `${markdown.replace(/\\-/g, '-').replace(/\\\|/g, '|')}`;

text += `${markdown
.replace(/\\-/g, '-')
.replace(/\\\|/g, '|')
.replace(/\*{2}/g, '*')
.replace(/\[(.+)\]\((.+)\)/g, '<$2|$1>')}`;
}
}

Expand Down

0 comments on commit f4fa9e9

Please sign in to comment.