Skip to content

Commit 6fcc426

Browse files
authored
Merge pull request #211 from marp-team/inclusive-language
Use inclusive language in branch and core features
2 parents b135954 + 0c76521 commit 6fcc426

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- Upgrade Marpit to [v1.6.4](https://github.com/marp-team/marpit/releases/v1.6.4) ([#210](https://github.com/marp-team/marp-core/pull/210))
88
- Upgrade dependent packages to the latest version ([#210](https://github.com/marp-team/marp-core/pull/210))
9+
- Rename `master` branch into `main` ([#211](https://github.com/marp-team/marp-core/pull/211))
910

1011
## v1.4.0 - 2020-12-05
1112

@@ -316,12 +317,12 @@
316317
### Added
317318

318319
- Allow using twemoji via PNG by added `emoji.twemoji.ext` option ([#67](https://github.com/marp-team/marp-core/pull/67))
319-
- Support custom sanitizer for whitelisted HTML attributes ([#68](https://github.com/marp-team/marp-core/pull/68))
320+
- Support custom sanitizer for HTML attributes within allowlist ([#68](https://github.com/marp-team/marp-core/pull/68))
320321
- Add usage of multiple classes in Gaia theme ([#69](https://github.com/marp-team/marp-core/pull/69))
321322

322323
### Fixed
323324

324-
- Fix over-sanitized attributes with HTML whitelist ([#68](https://github.com/marp-team/marp-core/pull/68))
325+
- Fix over-sanitized attributes with HTML allowlist ([#68](https://github.com/marp-team/marp-core/pull/68))
325326

326327
### Changed
327328

@@ -510,7 +511,7 @@
510511

511512
### Added
512513

513-
- Support HTML whitelisting ([#26](https://github.com/marp-team/marp-core/pull/26))
514+
- Support HTML allowlisting ([#26](https://github.com/marp-team/marp-core/pull/26))
514515

515516
### Fixed
516517

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# @marp-team/marp-core
22

3-
[![CircleCI](https://img.shields.io/circleci/project/github/marp-team/marp-core/master.svg?style=flat-square&logo=circleci)](https://circleci.com/gh/marp-team/marp-core/)
4-
[![Codecov](https://img.shields.io/codecov/c/github/marp-team/marp-core/master.svg?style=flat-square&logo=codecov)](https://codecov.io/gh/marp-team/marp-core)
3+
[![CircleCI](https://img.shields.io/circleci/project/github/marp-team/marp-core/main.svg?style=flat-square&logo=circleci)](https://circleci.com/gh/marp-team/marp-core/)
4+
[![Codecov](https://img.shields.io/codecov/c/github/marp-team/marp-core/main.svg?style=flat-square&logo=codecov)](https://codecov.io/gh/marp-team/marp-core)
55
[![npm](https://img.shields.io/npm/v/@marp-team/marp-core.svg?style=flat-square&logo=npm)](https://www.npmjs.com/package/@marp-team/marp-core)
66
[![LICENSE](https://img.shields.io/github/license/marp-team/marp-core.svg?style=flat-square)](./LICENSE)
77

@@ -33,7 +33,7 @@ Marp Markdown is based on [Marpit](https://github.com/marp-team/marpit) and [Com
3333
- Enable [inline SVG mode](https://github.com/marp-team/marpit#inline-svg-slide-experimental) and loose YAML parsing by default.
3434

3535
* **CommonMark**
36-
- For security reason, HTML tag only allows whitelisted elements by default.
36+
- For security reason, HTML tag only allows `<br />` by default.
3737
- Support [table](https://github.github.com/gfm/#tables-extension-) and [strikethrough](https://github.github.com/gfm/#strikethrough-extension-) syntax, based on [GitHub Flavored Markdown](https://github.github.com/gfm/).
3838
- Line breaks in paragraph will convert to `<br>` tag.
3939
- Auto convert URL like text into hyperlink.
@@ -206,12 +206,12 @@ const marp = new Marp({
206206

207207
### `html`: _`boolean`_ | _`object`_
208208

209-
Setting whether to render raw HTML in Markdown. It's an alias to `markdown.html` ([markdown-it option](https://markdown-it.github.io/markdown-it/#MarkdownIt.new)) but has additional feature about HTML whitelist.
209+
Setting whether to render raw HTML in Markdown. It's an alias to `markdown.html` ([markdown-it option](https://markdown-it.github.io/markdown-it/#MarkdownIt.new)) but has additional feature about HTML allowlist.
210210

211211
- `true`: The all HTML will be allowed.
212212
- `false`: All HTML except supported in Marpit Markdown will be disallowed.
213213

214-
By passing `object`, you can set the whitelist to specify allowed tags and attributes.
214+
By passing `object`, you can set the allowlist to specify allowed tags and attributes.
215215

216216
```javascript
217217
// Specify tag name as key, and attributes to allow as string array.

src/html/html.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@ export function markdown(md): void {
2222
...args
2323
) => {
2424
const ret = original(...args)
25-
const whiteList = {}
25+
const allowList = {}
2626
const html: MarpOptions['html'] = md.options.html
2727

2828
if (typeof html === 'object') {
2929
for (const tag of Object.keys(html)) {
3030
const attrs = html[tag]
3131

3232
if (Array.isArray(attrs)) {
33-
whiteList[tag] = attrs
33+
allowList[tag] = attrs
3434
} else if (typeof attrs === 'object') {
35-
whiteList[tag] = Object.keys(attrs).filter(
35+
allowList[tag] = Object.keys(attrs).filter(
3636
(attr) => attrs[attr] !== false
3737
)
3838
}
3939
}
4040
}
4141

4242
const filter = new FilterXSS({
43-
whiteList,
43+
whiteList: allowList,
4444
onIgnoreTag: (_, rawHtml) => (html === true ? rawHtml : undefined),
4545
safeAttrValue: (tag, attr, value) => {
4646
let ret = friendlyAttrValue(value)

test/marp.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ describe('Marp', () => {
233233
})
234234
})
235235

236-
describe('with whitelist', () => {
236+
describe('with allowlist', () => {
237237
const md = '<p>\ntest\n</p>\n\n<p class="class" title="title">test</p>'
238238
const html = { img: ['src'], p: ['class'] }
239239

240-
it('allows whitelisted tags and attributes', () => {
240+
it('allows tags and attributes in allowlist', () => {
241241
const $ = cheerio.load(marp({ html }).render(md).html)
242242

243243
expect($('p')).toHaveLength(2)
@@ -264,7 +264,7 @@ describe('Marp', () => {
264264
})
265265

266266
describe('when attributes are defined as object', () => {
267-
it('allows whitelisted attributes without defined false', () => {
267+
it('allows attributes in allowlist without defined false', () => {
268268
const instance = marp({ html: { p: { id: true, class: false } } })
269269
const { html } = instance.render('<p id="id" class="class"></p>')
270270

0 commit comments

Comments
 (0)