Escape the given source, for a markdown cell
351622
def markdown_to_text(self, source):
        """"""
        if self.comment and self.comment != "#'":
            source = copy(source)
            comment_magic(source, self.language, self.comment_magics)

        return comment_lines(source, self.comment)
918443
def replace_markdown_cells(src, dst):
    

    # It is an error to attempt markdown replacement if src and dst
    # have different numbers of cells
    if len(src['cells']) != len(dst['cells']):
        raise ValueError('notebooks do not have the same number of cells')

    # Iterate over cells in src
    for n in range(len(src['cells'])):
        # It is an error to attempt markdown replacement if any
        # corresponding pair of cells have different type
        if src['cells'][n]['cell_type'] != dst['cells'][n]['cell_type']:
            raise ValueError('cell number %d of different type in src and dst')
        # If current src cell is a markdown cell, copy the src cell to
        # the dst cell
        if src['cells'][n]['cell_type'] == 'markdown':
            dst['cells'][n]['source'] = src['cells'][n]['source']
1232100
def raw_escape(pattern, unix=False):
    """"""

    pattern = util.norm_pattern(pattern, False, True)
    return escape(pattern, unix)
708457
def escape_string(self, string):
        """"""
        if self.quote:
            quote = self.quote
        else:
            found = QUOTE_REGEX.search(string)
            quote = STRING_QUOTES[found.group()] if found else next(iter(STRING_QUOTES))

        for match, seq in ESCAPE_SUBS.items():
            if match == quote or match not in STRING_QUOTES:
                string = string.replace(match, seq)

        return f'{quote}{string}{quote}'
954267
function escape_code(defaultRenderer) {
  return function(tokens, idx, options, env, slf) {
    tokens[idx].content = tokens[idx].content
      .slice(2, -2)
      .replace(/\\`/g, '__BACK_TICK__');

    return defaultRenderer(tokens, idx, options, env, slf);
  };
}
121268
def do_forceescape(value):
    """"""
    if hasattr(value, '__html__'):
        value = value.__html__()
    return escape(unicode(value))
5241
def add_escape(self, idx, char):
        

        self.fmt.append_text(self.fmt._unescape.get(
            self.format[self.str_begin:idx], char))
645105
def escape(identifier, ansi_quotes, should_quote):
    
    if not should_quote(identifier):
        return identifier

    quote = '"' if ansi_quotes else '`'
    identifier = identifier.replace(quote, 2*quote)
    return '{0}{1}{2}'.format(quote, identifier, quote)
1320187
def _quote_escape(item):
    '''
    
    '''

    rex_sqlquote = re.compile("'", re.M)

    return rex_sqlquote.sub("''", item)
784344
def escape(s):
    """"""
    if not isinstance(s, bytes):
        s = s.encode('utf-8')
    return quote(s, safe='~')
687089
def maybe_render_markdown(string: str) -> Any:
    """"""
    if is_ipython_interpreter():  # pragma: no cover
        from IPython.display import Markdown  # type: ignore # noqa: E501

        return Markdown(string)
    else:
        return string
1294277
def _escape(self, text):
        """"""
        ret = EMPTYSTRING if text is None else str(text)
        if self.escape:
            return html_escape(ret)
        else:
            return ret
1168370
def escape_pre_section(table):
    """"""
    def replace_newline(g):
        return g.group(1).replace('\n', '\n.br\n')

    return re.sub('<pre.*?>(.*?)</pre>', replace_newline, table, flags=re.S)
387594
def escape_latex(text):
    
    """
    text = unicode(text.decode('utf-8'))
    CHARS = {
        '&': r'\&',
        '%': r'\%',
        '$': r'\$',
        '#': r'\#',
        '_': r'\_',
        '{': r'\{',
        '}': r'\}',
        '~': r'\~{}',
        '^': r'\^{}',
        '\\': r'\textbackslash{}',
    }
    escaped = "".join([CHARS.get(char, char) for char in text])
    return escaped.encode('utf-8')
1163450
def _escape_string(text, _map={}):
    
    if isinstance(text, str):
        text = text.encode('ascii')
    assert isinstance(text, (bytes, bytearray))

    if not _map:
        for ch in range(256):
            if ch in _VALID_CHARS:
                _map[ch] = chr(ch)
            else:
                _map[ch] = '\\%02x' % ch
            if six.PY2:
                _map[chr(ch)] = _map[ch]

    buf = [_map[ch] for ch in text]
    return ''.join(buf)
1236443
def MarkdownColumn(name, deferred=False, group=None, **kwargs):
    
    return composite(MarkdownComposite,
        Column(name + '_text', UnicodeText, **kwargs),
        Column(name + '_html', UnicodeText, **kwargs),
        deferred=deferred, group=group or name
    )
478362
function _escapeHtml (input) {
  return String(input)
   .replace(/&/g, '&amp;')
   .replace(/</g, '&lt;')
   .replace(/>/g, '&gt;')
   .replace(/"/g, '&quot;')
   .replace(/'/g, '&#039;');
 }