patrickallaert/ckeditor-markdown-plugin

CKEditor 的 Markdown 插件

1.0.0 2022-03-09 13:41 UTC

This package is auto-updated.

Last update: 2024-09-09 19:39:46 UTC


README

CKEditor 的 Markdown 插件 这是一个为 CKEditor 定制的插件,您可以在 CKEditor 中使用 markdown 模式。此外,您在 WYSIWYG 模式中的文章也可以转换为 markdown 格式。

开始使用

需要 ckeditor 标准版

您可以在 DEMO 中看到示例

使用方法

  1. 下载源代码,并将 markdown 文件夹解压到 ckeditor/plugins 路径下;
  2. 编辑 config.js(例如 ckeditor/config.js
	config.extraPlugins = 'markdown'; // add this plugin

享受使用吧!

config.js 示例

CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here.
	// For complete reference see:
	// http://docs.ckeditor.com/#!/api/CKEDITOR.config

	// The toolbar groups arrangement, optimized for two toolbar rows.
	config.toolbarGroups = [
		// { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
		// { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
		// { name: 'links' },
		// { name: 'insert' },
		// { name: 'forms' },
		{ name: 'tools' },
		// { name: 'document',	   groups: [ 'mode', 'document', 'doctools' ] },
		
		// '/',
		{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
		// { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
		{ name: 'styles' },
		{ name: 'others' }
		// { name: 'colors' },
		// { name: 'about' }
	];

	// Remove some buttons provided by the standard plugins, which are
	// not needed in the Standard(s) toolbar.
	config.removeButtons = 'Underline,Subscript,Superscript';
	config.extraPlugins = 'markdown';  // this is the point!
	// Set the most common block elements.
	config.format_tags = 'p;h1;h2;h3;pre';

	// Simplify the dialog windows.
	config.removeDialogTabs = 'image:advanced;link:advanced';
};

您也可以使用 bower 来安装它。

bower install ckeditor-markdown-plugin

感谢