MCPcopy Index your code
hub / github.com/cnodejs/nodeclub / _EncodeCode

Function _EncodeCode

public/libs/showdown.js:1087–1115  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

1085
1086
1087var _EncodeCode = function(text) {
1088//
1089// Encode/escape certain characters inside Markdown code runs.
1090// The point is that in code, these characters are literals,
1091// and lose their special Markdown meanings.
1092//
1093 // Encode all ampersands; HTML entities are not
1094 // entities within a Markdown code span.
1095 text = text.replace(/&/g,"&");
1096
1097 // Do the angle bracket song and dance:
1098 text = text.replace(/</g,"&lt;");
1099 text = text.replace(/>/g,"&gt;");
1100
1101 // Now, escape characters that are magic in Markdown:
1102 text = escapeCharacters(text,"\*_{}[]\\",false);
1103
1104// jj the line above breaks this:
1105//---
1106
1107//* Item
1108
1109// 1. Subitem
1110
1111// special char: *
1112//---
1113
1114 return text;
1115}
1116
1117
1118var _DoItalicsAndBold = function(text) {

Callers 3

_DoCodeBlocksBeforeFunction · 0.70
_DoCodeBlocksFunction · 0.70
_DoCodeSpansFunction · 0.70

Calls 1

escapeCharactersFunction · 0.70

Tested by

no test coverage detected