浏览代码

Update markdown gfm module documentation.

Maciej Gołaszewski 5 年之前
父节点
当前提交
317fcfaa52

+ 10 - 4
packages/ckeditor5-markdown-gfm/src/html2markdown/html2markdown.js

@@ -3,14 +3,14 @@
  * For licensing, see LICENSE.md.
  */
 
-// JSDoc validation fails without the following line for an unknown reason.
-/** @module */
+/**
+ * @module markdown-gfm/html2markdown
+ */
 
 import TurndownService from 'turndown';
 import { gfm } from 'turndown-plugin-gfm';
 
-// Overrides the escape() method, enlarging it.
-
+// Override the original escape method by not escaping links.
 const originalEscape = TurndownService.prototype.escape;
 
 function escape( string ) {
@@ -66,6 +66,12 @@ turndownService.use( [
 	todoList
 ] );
 
+/**
+ * Parses HTML to a markdown.
+ *
+ * @param {String} html
+ * @returns {String}
+ */
 export default function html2markdown( html ) {
 	return turndownService.turndown( html );
 }

+ 10 - 2
packages/ckeditor5-markdown-gfm/src/markdown2html/markdown2html.js

@@ -3,8 +3,18 @@
  * For licensing, see LICENSE.md.
  */
 
+/**
+ * @module markdown-gfm/markdown2html
+ */
+
 import marked from 'marked';
 
+/**
+ * Parses markdown string to an HTML.
+ *
+ * @param {String} markdown
+ * @returns {String}
+ */
 export default function markdown2html( markdown ) {
 	return marked.parse( markdown, {
 		gfm: true,
@@ -17,8 +27,6 @@ export default function markdown2html( markdown ) {
 
 export { marked };
 
-// Overrides.
-
 // Disable the autolink rule in the lexer (point it to a regex that always fail).
 marked.InlineLexer.rules.breaks.autolink = /^\b$/;
 marked.InlineLexer.rules.breaks.url = /^\b$/;