8000 Remove dollar prefix plugin for obsolated syntax by yhatt · Pull Request #127 · marp-team/marp-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remove dollar prefix plugin for obsolated syntax #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Upgrade Marpit to [v1.4.2](https://github.com/marp-team/marpit/releases/v1.4.2) ([#126](https://github.com/marp-team/marp-core/pull/126))
- Upgrade dependent packages to the latest version ([#126](https://github.com/marp-team/marp-core/pull/126))

### Removed

- Remove dollar prefix plugin for obsolated syntax ([#127](https://github.com/marp-team/marp-core/pull/127))

## v0.15.0 - 2019-11-05

### Added
Expand Down
20 changes: 0 additions & 20 deletions src/dollar/dollar.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/marp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import postcssMinifySelectors from 'postcss-minify-selectors'
import postcssNormalizeWhitespace from 'postcss-normalize-whitespace'
import { version } from 'katex/package.json'
import browser from './browser'
import * as dollarPlugin from './dollar/dollar'
import * as emojiPlugin from './emoji/emoji'
import * as fittingPlugin from './fitting/fitting'
import * as htmlPlugin from './html/html'
Expand All @@ -30,9 +29,6 @@ export interface MarpOptions extends MarpitOptions {
math?: mathPlugin.MathOptions
minifyCSS?: boolean
script?: boolean | scriptPlugin.ScriptOptions

/** @deprecated Dollar prefix for global directives is removed feature in Marpit framework, and Marp Core does not recommend too. Please use only for keeping compatibility in limited cases. */
dollarPrefixForGlobalDirectives?: boolean
}

const styleMinifier = postcss([
Expand All @@ -55,7 +51,6 @@ export class Marp extends Marpit {
math: true,
minifyCSS: true,
script: true,
dollarPrefixForGlobalDirectives: false,
...opts,
emoji: {
shortcode: 'twemoji',
Expand Down Expand Up @@ -95,7 +90,6 @@ export class Marp extends Marpit {
.use(mathPlugin.markdown, flag => (this.renderedMath = flag))
.use(fittingPlugin.markdown)
.use(sizePlugin.markdown)
.use(dollarPlugin.markdown)
.use(scriptPlugin.markdown)
}

Expand Down
57 changes: 0 additions & 57 deletions test/marp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,63 +665,6 @@ describe('Marp', () => {
})
})

describe('dollarPrefixForGlobalDirectives option', () => {
it('cannot use dollar prefix for global directives by default', () => {
const instance = marp({ minifyCSS: false })

// $theme
expect(instance.render('<!-- $theme: gaia -->').css).not.toContain(
'@theme gaia'
)

// $style
expect(
instance.render('<!-- $style: "h6 { color: orange }" -->').css
).not.toContain('color: orange')

// $headingDivider
expect(
instance.render('<!-- $headingDivider: 1 -->\n\n# 1\n# 2', {
htmlAsArray: true,
}).html
).toHaveLength(1)

// $size (Custom directives extended by Marp Core)
const [html] = instance.render('<!-- $size: 4:3 -->', {
htmlAsArray: true,
}).html
expect(html).not.toContain('0 0 960 720')
})

context('with true', () => {
it('can use dollar prefix as aliases for global directives', () => {
const instance = marp({
dollarPrefixForGlobalDirectives: true,
minifyCSS: false,
})

expect(instance.render('<!-- $theme: gaia -->').css).toContain(
'@theme gaia'
)

expect(
instance.render('<!-- $style: "h6 { color: orange }" -->').css
).toContain('color: orange')

expect(
instance.render('<!-- $headingDivider: 1 -->\n\n# 1\n# 2', {
htmlAsArray: true,
}).html
).toHaveLength(2)

const [html] = instance.render('<!-- $size: 4:3 -->', {
htmlAsArray: true,
}).html
expect(html).toContain('0 0 960 720')
})
})
})

describe('size global directive', () => {
it('defines size custom global directive', () =>
expect(marp().customDirectives.global.size).toBeTruthy())
Expand Down
0