Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Introduced the Markdown plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredck committed May 2, 2020
1 parent 15bacf5 commit 9d03c0a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
35 changes: 35 additions & 0 deletions 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';
}
}
24 changes: 24 additions & 0 deletions tests/markdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @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 );
} );
} );
} );

0 comments on commit 9d03c0a

Please sign in to comment.