Skip to content

Commit d4a1de4

Browse files
authored
Initial commit
0 parents  commit d4a1de4

17 files changed

+22565
-0
lines changed

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*.{json,js}]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 2
9+
10+
[*.md]
11+
charset = utf-8
12+
end_of_line = lf
13+
insert_final_newline = true
14+
trim_trailing_whitespace = true
15+
indent_style = tab
16+
indent_size = 4

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lib
2+
*.min.js

.eslintrc.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"extends": "standard",
3+
"rules": {
4+
"semi": ["error", "always"],
5+
"indent": ["error", 2, {
6+
"SwitchCase": 1,
7+
"VariableDeclarator": { "var": 2 },
8+
"outerIIFEBody": 0
9+
}],
10+
"operator-linebreak": ["error", "before", { "overrides": { "=": "after" } }],
11+
"space-before-function-paren": ["error", "never"],
12+
"no-cond-assign": "off",
13+
"no-useless-escape": "off",
14+
"one-var": "off",
15+
"no-control-regex": "off",
16+
"no-prototype-builtins": "off",
17+
"no-extra-semi": "error",
18+
19+
"prefer-const": "error",
20+
"no-var": "error"
21+
},
22+
"env": {
23+
"node": true,
24+
"jest": true
25+
}
26+
}

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
- package-ecosystem: "npm"
8+
versioning-strategy: "increase"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.github/workflows/automerge.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Automerge"
2+
on:
3+
workflow_run:
4+
workflows:
5+
- CI
6+
types:
7+
- completed
8+
9+
jobs:
10+
Automerge:
11+
runs-on: ubuntu-latest
12+
if: |
13+
github.event.workflow_run.event == 'pull_request' &&
14+
github.event.workflow_run.conclusion == 'success'
15+
steps:
16+
- name: 'Merge PR'
17+
uses: actions/github-script@v6
18+
with:
19+
github-token: ${{ secrets.GITHUB_TOKEN }}
20+
script: |
21+
const pr = await github.rest.pulls.get({
22+
owner: context.repo.owner,
23+
repo: context.repo.repo,
24+
pull_number: context.payload.workflow_run.pull_requests[0].number,
25+
});
26+
if (!pr.data.title.startsWith('chore(deps-dev):')) {
27+
console.log('Not Merged 🚫');
28+
console.log(`Title '${pr.data.title}' does not start with 'chore(deps-dev):'`);
29+
} else if (pr.data.user.login !== 'dependabot[bot]') {
30+
console.log('Not Merged 🚫');
31+
console.log(`User '${pr.data.user.login}' does not equal 'dependabot[bot]'`);
32+
} else {
33+
await github.rest.pulls.merge({
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
pull_number: context.payload.workflow_run.pull_requests[0].number,
37+
});
38+
console.log('Merged 🎉');
39+
}

.github/workflows/main.yml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: "CI"
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
10+
Test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout@v3
15+
- name: Install Node
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: '*'
19+
- name: Install Dependencies
20+
run: npm ci
21+
- name: Run Tests 👩🏽‍💻
22+
run: npm run test
23+
24+
Coverage:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout Code
28+
uses: actions/checkout@v3
29+
- name: Install Node
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: 'lts/*'
33+
- name: Install Dependencies
34+
run: npm ci
35+
- name: Run Tests 👩🏽‍💻
36+
run: npm run test:cover
37+
38+
Lint:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout Code
42+
uses: actions/checkout@v3
43+
- name: Install Node
44+
uses: actions/setup-node@v3
45+
with:
46+
node-version: 'lts/*'
47+
- name: Install Dependencies
48+
run: npm ci
49+
- name: Lint ✨
50+
run: npm run lint
51+
52+
Build:
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Checkout Code
56+
uses: actions/checkout@v3
57+
- name: Install Node
58+
uses: actions/setup-node@v3
59+
with:
60+
node-version: 'lts/*'
61+
- name: Install Dependencies
62+
run: npm ci
63+
- name: Build 🗜️
64+
run: npm run build
65+
66+
############ Requires NPM_TOKEN in secrets ############
67+
# Release:
68+
# needs: [Test, Coverage, Lint, Build]
69+
# if: |
70+
# github.ref == 'refs/heads/main' &&
71+
# github.event.repository.fork == false
72+
# runs-on: ubuntu-latest
73+
# steps:
74+
# - name: Checkout Code
75+
# uses: actions/checkout@v3
76+
# - name: Install Node
77+
# uses: actions/setup-node@v3
78+
# with:
79+
# node-version: 'lts/*'
80+
# - name: Install Dependencies
81+
# run: npm ci
82+
# - name: Build 🗜️
83+
# run: |
84+
# npm run build
85+
# if ! git diff --quiet; then
86+
# git config --global user.email "<>"
87+
# git config --global user.name "CI Build"
88+
# git commit -am "🗜️ build [skip ci]"
89+
# fi
90+
# - name: Release 🎉
91+
# env:
92+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
94+
# run: npx semantic-release

.gitignore

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port
105+
106+
# hide build files
107+
lib/

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 @markedjs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- The character `|` around a string denotes a place in this markdown file that needs to be changed for each extension. -->
2+
<!-- You may also delete any comments you don't need anymore. -->
3+
4+
# TODO:
5+
6+
- [ ] Replace information in `/README.md`
7+
- [ ] Replace name in `/rollup.config.js`
8+
- [ ] Replace information in `/package.json`
9+
- [ ] Write extension in `/src/index.js`
10+
- [ ] Write tests in `/spec/index.test.js`
11+
- [ ] Uncomment release in `/.github/workflows/main.yml`
12+
13+
<!-- Delete this line and above -->
14+
15+
# marked-|this-extension|
16+
<!-- Description -->
17+
18+
# Usage
19+
<!-- Show most examples of how to use this extension -->
20+
21+
```js
22+
import {marked} from "marked";
23+
import |thisExtension| from "marked-|this-extension|";
24+
25+
// or UMD script
26+
// <script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script>
27+
// <script src="https://cdn.jsdelivr.net/npm/marked-|this-extension|/lib/index.umd.js"></script>
28+
29+
const options = {
30+
// |default options|
31+
};
32+
33+
marked.use(|thisExtension|(options));
34+
35+
marked.parse("|example markdown|");
36+
// <p>|example html|</p>
37+
```
38+
39+
## `options`
40+
41+
<!-- If there are no options you can delete this section -->

babel.config.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@babel/preset-env"]
3+
}

jest.config.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export default {
2+
restoreMocks: true,
3+
clearMocks: true,
4+
// collectCoverage: true,
5+
collectCoverageFrom: [
6+
'src/index.js'
7+
],
8+
coverageDirectory: 'coverage',
9+
coverageThreshold: {
10+
global: {
11+
branches: 100,
12+
functions: 100,
13+
lines: 100,
14+
statements: 100
15+
}
16+
},
17+
testRegex: /\.test\.js$/.source,
18+
transform: {
19+
'\\.[jt]sx?$': 'babel-jest'
20+
}
21+
};

0 commit comments

Comments
 (0)