-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bcfecf3
Showing
10 changed files
with
504 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# These are supported funding model platforms | ||
|
||
# github: [jaywcjlove] | ||
# patreon: # Replace with a single Patreon username | ||
# open_collective: # Replace with a single Open Collective username | ||
# ko_fi: # Replace with a single Ko-fi username | ||
# tidelift: #npm/mocker-api | ||
# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
custom: https://jaywcjlove.github.io/#/sponsor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- run: npm install | ||
- run: npm run build | ||
- run: npm run type-check | ||
- run: npm run coverage | ||
|
||
- name: Create idoc config | ||
run: | | ||
cat > idoc.yml << EOF | ||
site: "rehype-github-alert {{version}}" | ||
openSource: https://github.com/jaywcjlove/remark-github-alert | ||
menus: | ||
Attr: https://jaywcjlove.github.io/rehype-attr/ | ||
Ignore: index.html | ||
Rewrite: https://jaywcjlove.github.io/rehype-rewrite/ | ||
Video: https://jaywcjlove.github.io/rehype-video/ | ||
Sponsor: https://jaywcjlove.github.io/#/sponsor | ||
footer: | | ||
<a href="https://jaywcjlove.github.io/rehype-attr/" target="_blank">Attr</a> • | ||
<a href="https://wangchujiang.com/#/projects" target="_blank">Projects</a> • | ||
<a href="https://wangchujiang.com/#/sponsor" target="_blank">Sponsor</a> • | ||
<a href="https://wangchujiang.com/#/app" target="_blank">More Apps</a><br /><br /> | ||
Generated by <a href="https://github.com/jaywcjlove/idoc" target="_blank">idoc</a> v{{idocVersion}} | ||
EOF | ||
- run: npm install idoc@1 -g | ||
- run: idoc | ||
|
||
- run: cp -rp ./coverage/lcov-report dist | ||
- name: Create Coverage Badges | ||
uses: jaywcjlove/coverage-badges-cli@main | ||
with: | ||
output: dist/badges.svg | ||
|
||
- name: Generate Contributors Images | ||
uses: jaywcjlove/github-action-contributors@main | ||
with: | ||
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\]) | ||
output: dist/CONTRIBUTORS.svg | ||
avatarSize: 42 | ||
|
||
- name: Create Tag | ||
id: create_tag | ||
uses: jaywcjlove/create-tag-action@main | ||
with: | ||
package-path: ./package.json | ||
|
||
- name: get tag version | ||
id: tag_version | ||
uses: jaywcjlove/changelog-generator@main | ||
|
||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
user_name: 'github-actions[bot]' | ||
user_email: 'github-actions[bot]@users.noreply.github.com' | ||
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./dist | ||
|
||
- name: Generate Changelog | ||
id: changelog | ||
uses: jaywcjlove/changelog-generator@main | ||
with: | ||
head-ref: ${{steps.create_tag.outputs.version}} | ||
filter-author: (小弟调调™|Renovate Bot) | ||
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}' | ||
|
||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
if: steps.create_tag.outputs.successful | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: ${{ steps.create_tag.outputs.version }} | ||
tag: ${{ steps.create_tag.outputs.version }} | ||
body: | | ||
[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor) [![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/rehype-github-alert@${{steps.create_tag.outputs.versionNumber}}/file/README.md) | ||
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/jaywcjlove/rehype-github-alert/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html | ||
Comparing Changes: ${{ steps.changelog.outputs.compareurl }} | ||
${{ steps.changelog.outputs.changelog }} | ||
- run: npm publish --access public --provenance | ||
name: 📦 rehype-github-alert publish to NPM | ||
continue-on-error: true | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: PR Build | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- run: npm install | ||
- run: npm run build | ||
- run: npm run type-check | ||
- run: npm run coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
coverage | ||
build | ||
node_modules | ||
lib | ||
npm-debug.log* | ||
package-lock.json | ||
|
||
.eslintcache | ||
.DS_Store | ||
.cache | ||
.vscode | ||
|
||
*.bak | ||
*.tem | ||
*.temp | ||
#.swp | ||
*.*~ | ||
~*.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
remark-github-alert | ||
=== | ||
<!--rehype:style=display: flex; height: 230px; align-items: center; justify-content: center; font-size: 38px;--> | ||
|
||
[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor) | ||
[![Downloads](https://img.shields.io/npm/dm/rehype-github-alert.svg?style=flat)](https://www.npmjs.com/package/rehype-github-alert) | ||
[![NPM version](https://img.shields.io/npm/v/rehype-github-alert.svg?style=flat)](https://npmjs.org/package/rehype-github-alert) | ||
[![Build](https://github.com/jaywcjlove/rehype-github-alert/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/rehype-github-alert/actions/workflows/ci.yml) | ||
[![Coverage Status](https://jaywcjlove.github.io/rehype-github-alert/badges.svg)](https://jaywcjlove.github.io/rehype-github-alert/lcov-report/) | ||
[![Repo Dependents](https://badgen.net/github/dependents-repo/jaywcjlove/rehype-github-alert)](https://github.com/jaywcjlove/rehype-github-alert/network/dependents) | ||
|
||
Remark plugin to add support for [GitHub Alert](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts) | ||
|
||
Alerts are a Markdown extension based on the blockquote syntax that you can use to emphasize critical information. | ||
|
||
## Installation | ||
|
||
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): Node 12+ is needed to use it and it must be `import` instead of `require`. | ||
|
||
```bash | ||
npm install rehype-github-alert | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
import plugin from 'rehype-github-alert' | ||
|
||
const html = String( | ||
await remark().use(remarkParse).use(plugin).use(remarkRehype).use(rehypeStringify).process(`\ | ||
# Alert | ||
> [!NOTE] | ||
> test | ||
`), | ||
) | ||
``` | ||
|
||
The output HTML will be: | ||
|
||
```html | ||
<h1>Alert</h1> | ||
<div class="markdown-alert markdown-alert-note" dir="auto"> | ||
<p class="markdown-alert-title" dir="auto"><svg class="octicon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>NOTE</p> | ||
<p>Useful information that users should know, even when skimming content.</p> | ||
</div> | ||
``` | ||
|
||
|
||
## Related | ||
|
||
- [`rehype-rewrite`](https://github.com/jaywcjlove/rehype-rewrite) Rewrite element with rehype. | ||
- [`rehype-video`](https://github.com/jaywcjlove/rehype-video) Add improved video syntax: links to `.mp4` and `.mov` turn into videos. | ||
- [`rehype-attr`](https://github.com/jaywcjlove/rehype-attr) New syntax to add attributes to Markdown. | ||
- [`rehype-ignore`](https://github.com/jaywcjlove/rehype-ignore) Ignore content display via HTML comments, Shown in GitHub readme, excluded in HTML. | ||
|
||
## Contributors | ||
|
||
As always, thanks to our amazing contributors! | ||
|
||
<a href="https://github.com/jaywcjlove/remark-github-alert/graphs/contributors"> | ||
<img src="https://jaywcjlove.github.io/remark-github-alert/CONTRIBUTORS.svg" /> | ||
</a> | ||
|
||
Made with [contributors](https://github.com/jaywcjlove/github-action-contributors). | ||
|
||
## License | ||
|
||
MIT © [Kenny Wong](https://github.com/jaywcjlove) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"name": "remark-github-alert", | ||
"version": "0.0.1", | ||
"description": "Alerts are a Markdown extension based on the blockquote syntax that you can use to emphasize critical information.", | ||
"homepage": "https://jaywcjlove.github.io/remark-github-alert", | ||
"funding": "https://jaywcjlove.github.io/#/sponsor", | ||
"author": "Kenny Wong <[email protected]>", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"type": "module", | ||
"typings": "./lib/index.d.ts", | ||
"exports": "./lib/index.js", | ||
"scripts": { | ||
"prepack": "npm run build", | ||
"start": "node lib/index.js", | ||
"watch": "tsbb watch", | ||
"build": "tsbb build", | ||
"type-check": "tsc --noEmit", | ||
"test": "tsbb test", | ||
"coverage": "tsbb test --coverage" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jaywcjlove/remark-github-alert" | ||
}, | ||
"files": [ | ||
"src", | ||
"lib" | ||
], | ||
"keywords": [ | ||
"remark", | ||
"remark-ignore", | ||
"ignore", | ||
"element", | ||
"markdown", | ||
"javascript", | ||
"html", | ||
"ast", | ||
"unified" | ||
], | ||
"jest": { | ||
"extensionsToTreatAsEsm": [ | ||
".ts" | ||
], | ||
"moduleNameMapper": { | ||
"^(\\.{1,2}/.*)\\.js$": "$1" | ||
}, | ||
"transformIgnorePatterns": [ | ||
"<rootDir>/node_modules/?!(.*)" | ||
] | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"dependencies": { | ||
"unist-util-visit": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"hast-util-select": "^6.0.0", | ||
"rehype": "^13.0.0", | ||
"rehype-raw": "^7.0.0", | ||
"rehype-stringify": "^10.0.0", | ||
"remark": "^15.0.1", | ||
"remark-parse": "^11.0.0", | ||
"remark-rehype": "^11.0.0", | ||
"tsbb": "^4.2.5", | ||
"unified": "^11.0.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": [ | ||
"config:base" | ||
], | ||
"packageRules": [ | ||
{ | ||
"matchPackagePatterns": ["*"], | ||
"rangeStrategy": "replace" | ||
} | ||
] | ||
} |
Oops, something went wrong.