Skip to content

Commit

Permalink
Introduced the Markdown plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredck committed Aug 11, 2020
1 parent 2222f8c commit 4149101
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/ckeditor5-markdown-gfm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"ckeditor5-plugin"
],
"dependencies": {
"@ckeditor/ckeditor5-core": "^21.0.0",
"@ckeditor/ckeditor5-engine": "^21.0.0"
},
"engines": {
Expand Down
35 changes: 35 additions & 0 deletions packages/ckeditor5-markdown-gfm/src/markdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/**
* @module markdown-gfm/markdown
*/

import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import GFMDataProcessor from './gfmdataprocessor';

/**
* The GitHub Flavored Markdown (GFM) plugin.
*
* For a detailed overview, check the {@glink features/markdown Markdown feature documentation}.
*
* @extends module:core/plugin~Plugin
*/
export default class Markdown extends Plugin {
/**
* @inheritDoc
*/
constructor( editor ) {
super( editor );
editor.data.processor = new GFMDataProcessor();
}

/**
* @inheritDoc
*/
static get pluginName() {
return 'Markdown';
}
}
26 changes: 26 additions & 0 deletions packages/ckeditor5-markdown-gfm/tests/markdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

import Markdown from '../src/markdown';
import GFMDataProcessor from '../src/gfmdataprocessor';
import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';

describe( 'Markdown', () => {
it( 'has proper name', () => {
expect( Markdown.pluginName ).to.equal( 'Markdown' );
} );

it( 'should set editor.data.processor', () => {
return ClassicTestEditor
.create( '', {
plugins: [ Markdown ]
} )
.then( editor => {
expect( editor.data.processor ).to.be.an.instanceof( GFMDataProcessor );

editor.destroy(); // Tests cleanup.
} );
} );
} );

0 comments on commit 4149101

Please sign in to comment.