Skip to content

Latest commit

 

History

History
88 lines (64 loc) · 3.43 KB

File metadata and controls

88 lines (64 loc) · 3.43 KB
menu-title meta-title meta-description category order modified_at
Paste Markdown
Paste Markdown | CKEditor 5 Documentation
The paste Markdown feature lets users paste Markdown-formatted content straight into CKEditor 5.
features-pasting
40
2023-11-24

Paste Markdown

The paste Markdown feature lets users paste Markdown-formatted content straight into the editor. It will be then converted into rich text on the fly.

This feature is still in the experimental phase. See the [known issues](#known-issues) section to learn more.

Demo

Paste some Markdown-formatted content into the demo editor below and see it turn into rich text on the fly. You can copy this document for convenience.

{@snippet features/paste-from-markdown}

This demo presents a limited set of features. Visit the {@link examples/builds/full-featured-editor feature-rich editor example} to see more in action.

Installation

This feature is not available in any of the {@link installation/getting-started/predefined-builds predefined builds}.

To enable this data processor in your editor, install the @ckeditor/ckeditor5-markdown-gfm package:

npm install --save @ckeditor/ckeditor5-markdown-gfm

Then add the {@link module:markdown-gfm/pastefrommarkdownexperimental~PasteFromMarkdownExperimental} plugin to the editor configuration:

import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic';

import { Bold, Italic } from '@ckeditor/ckeditor5-basic-styles';
import { Essentials } from '@ckeditor/ckeditor5-essentials';
// More imports.
// ...

import { PasteFromMarkdownExperimental } from '@ckeditor/ckeditor5-markdown-gfm';

ClassicEditor
	.create( document.querySelector( '#snippet-markdown' ), {
		plugins: [
			PasteFromMarkdownExperimental,
			Essentials,
			Bold,
			Italic,
			// More plugins.
			// ...
		],
		// More of editor's configuration.
		// ...
	} )
	.then( /* ... */ )
	.catch( /* ... */ );
Read more about {@link installation/plugins/installing-plugins installing plugins}.

Known issues

While the paste Markdown feature is already stable enough to use, it still needs some more testing. We are now focused on testing it in connection with other tools and plugins. If you have any observations, suggestions, or feedback you want to share, feel free to put them in this GitHub issue.

Related features

CKEditor 5 supports a wider range of paste features, including:

  • {@link features/paste-from-office Paste from Office} – Paste content from Microsoft Word and keep the original structure and formatting.
  • {@link features/paste-from-google-docs Paste from Google Docs} – Paste content from Google Docs, maintaining the original formatting and structure.
  • {@link features/paste-plain-text Paste plain text} – Paste text without formatting that will inherit the style of the content it was pasted into.
  • {@link features/autoformat Autoformatting} – Format your content on the go with Markdown-like shortcodes.

Contribute

The source code of the feature is available on GitHub at https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-markdown-gfm