Skip to content

Commit 445abdf

Browse files
committed
build: move function to module scope
1 parent cb7746e commit 445abdf

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

  • lib/node_modules/@stdlib/_tools/remark/plugins/remark-stdlib-related/lib

lib/node_modules/@stdlib/_tools/remark/plugins/remark-stdlib-related/lib/escape_markdown.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,25 @@ var replace = require( '@stdlib/string/base/replace' );
2828
var RE_MARKDOWN_OR_CODE = /(```[\s\S]+?```|`[\s\S]*?`)|([\\*_[#!~|])/g;
2929

3030

31+
// FUNCTIONS //
32+
33+
/**
34+
* Callback invoked for each match of a Markdown special character.
35+
*
36+
* @private
37+
* @param {string} match - matched substring
38+
* @param {string} code - code block or inline code
39+
* @param {string} markdown - Markdown characters
40+
* @returns {string} replacement string
41+
*/
42+
function onMatch( match, code, markdown ) {
43+
if ( code ) {
44+
return code;
45+
}
46+
return '\\' + markdown;
47+
}
48+
49+
3150
// MAIN //
3251

3352
/**
@@ -52,22 +71,6 @@ var RE_MARKDOWN_OR_CODE = /(```[\s\S]+?```|`[\s\S]*?`)|([\\*_[#!~|])/g;
5271
*/
5372
function escapeMarkdown( str ) {
5473
return replace( str, RE_MARKDOWN_OR_CODE, onMatch );
55-
56-
/**
57-
* Callback invoked for each match.
58-
*
59-
* @private
60-
* @param {string} match - matched substring
61-
* @param {string} code - code block or inline code
62-
* @param {string} markdown - Markdown characters
63-
* @returns {string} replacement string
64-
*/
65-
function onMatch( match, code, markdown ) {
66-
if ( code ) {
67-
return code;
68-
}
69-
return '\\' + markdown;
70-
}
7174
}
7275

7376

0 commit comments

Comments
 (0)