Also from the wintersmith markdown plugin.
328129
function extractMetadata (content, callback) {
  var end;
  var result;
  var metadata = '';
  var body = content;

  // Metadata is defined by either starting and ending line,
  if (content.slice(0, 3) === '---') {
    result = content.match(/^-{3,}\s([\s\S]*?)-{3,}(\s[\s\S]*|\s?)$/);
    if (result && result.length === 3) {
      metadata = result[1];
      body = result[2];
    }
  }
  // or Markdown metadata section at beginning of file.
  else if (content.slice(0, 12) === '```metadata\n') {
    end = content.indexOf('\n```\n');
    if (end !== -1) {
      metadata = content.substring(12, end);
      body = content.substring(end + 5);
    }
  }

  parseMetadata(metadata, function (error, parsed) {
    if (error) return callback(error);
    callback(null, {
      metadata: parsed,
      body: body
    });
  });
}
774536
function Plugin() {
  // return value should be a callable function
  // with strictly defined options passed by markdown-it
  var self = function(md, options) {
    self.options = options
    self.init(md)
  }

  // initialize plugin object
  self.__proto__ = Plugin.prototype

  self.id     = 'render-readme-meta'

  return self
}
633308
function plugin(palettes) {
  /**
   * Attempt to parse color. Copied from Stylus source code.
   *
   * @param {String} str
   * @return {RGBA}
   * @api private
   */
  var parseColor = function parseColor (str) {
    if (str.substr(0,1) === '#') {
      // Handle color shorthands (like #abc)
      var shorthand = str.length === 4,
          m = str.match(shorthand ? /\w/g : /\w{2}/g);

      if (!m) return;
      m = m.map(function(s) { return parseInt(shorthand ? s+s : s, 16) });
      return new nodes.RGBA(m[0],m[1],m[2],1);
    }
    else if (str.substr(0,3) === 'rgb'){
      var m = str.match(/([0-9]*\.?[0-9]+)/g);
      if (!m) return;
      m = m.map(function(s){return parseFloat(s, 10)});
      return new nodes.RGBA(m[0], m[1], m[2], m[3] || 1);
    }
    else {
      var rgb = colors[str];
      if (!rgb) return;
      return new nodes.RGBA(rgb[0], rgb[1], rgb[2], 1);
    }
  };

  return function (style) {
    var getColor = function (paletteName, colorName) {
      var paletteName = paletteName.toString();
      var colorName = (new nodes.Literal(colorName)).toString().string;
      var color = parseColor(palettes[paletteName][colorName]);

      return color;
    };
    var getPalette = function (paletteName) {
      return function (colorName) {
        return getColor(paletteName, colorName);
      }
    };

    style.define('palette', getColor);

    // Construct custom functions for every palette
    Object.keys(palettes).forEach(function (paletteName) {
      style.define(['palette', paletteName].join('-'), getPalette(paletteName));
    });
  };
}
36672
function plugin(options) {
  options = normalize(options);

  return function(files, metalsmith, done) {
    var tbConvertedFiles = _.filter(Object.keys(files), function(file) {
      return minimatch(file, options.match);
    });

    var convertFns = _.map(tbConvertedFiles, function(file) {
      debug("Asyncly converting file %s", file);
      var data = files[file];

      return function(cb) {
        var NormalizedRho = null;
        if (_.isPlainObject(options.blockCompiler)) {
          NormalizedRho = options.blockCompiler;
        } else if (_.isFunction(options.blockCompiler)) {
          NormalizedRho = options.blockCompiler(files, file, data);
        } else {
          NormalizedRho = require("rho").BlockCompiler;
        }

        var html = (new NormalizedRho()).toHtml(data.contents.toString());
        data.contents = new Buffer(html);
        cb(null, html);
      };
    });

    async.parallel(convertFns, function(err) {
      if (err) {
        debug("A file failed to compile: %s", err);
        done(new Error());
      }

      _.forEach(tbConvertedFiles, function(file) {
        var contents = files[file];
        var extension = path.extname(file);
        var fileNameWoExt = path.basename(file, extension);
        var dirname = path.dirname(file);
        var renamedFile = path.join(dirname, fileNameWoExt + "." + options.extension);
        files[renamedFile] = contents;

        delete files[file];
      });
      done();
    });
  };
}
151442
function plugin(options){
  options = options || {};
  var keys = options.keys || [];

  return function(files, metalsmith, done){
    setImmediate(done);
    Object.keys(files).forEach(function(file){
      debug('checking file: %s', file);
      if (!isHtml(file)) return;
      var data = files[file];
      var dir = dirname(file);
      var html = basename(file, extname(file)) + '.html';
      if ('.' != dir) html = dir + '/' + html;

      debug('Encoding html entities in file: %s', file);

      var reg = /\`\`\`([\s\S]+?)\`\`\`/gi;
      var rep = function(match, group) {
        if (group) {
          return he.encode(group, {useNamedReferences: true});
        }
        else {
          return "";
        }
      };
      var encoded = data.contents.toString().replace(reg, rep);
      data.contents = new Buffer(encoded);

      keys.forEach(function(key) {
        data[key] = data[key].replace(reg, rep);
      });

      delete files[file];
      files[html] = data;
    });
  };
}
403138
function(source) {

    // Remove comment markup from comments
    var comment = source.split(/\/\/[ ]?/).join('').split('/*').join('').split('*/').join(''),
      additionalKssParams = {},
      _this = this;

    comment = standardizeLinebreaks(comment);
    comment = trimLinebreaks(comment);

    comment.split('\n\n').forEach(function(markUpBlock) {

      var varName = markUpBlock.match(/([^:^\n]*):[\s\S]*\n/);
      if (varName && varName[1] !== undefined) {
        varName = varName[1].trim();
      }
      if (varName && varName.substring(0, 3) === 'sg-') {
        additionalKssParams[varName] = _this.getValue(varName, markUpBlock);
      }

    });

    return additionalKssParams;
  }
15789
function plugin(options) {

    return function(files, metalsmith, done) {

        Object.keys(files).forEach(function(file) {
            var data = files[file];
            data.contents = new Buffer(special(data.contents.toString()));
        });
        done();
    }
}
1007259
def _intermediary_to_markdown(tables, relationships):
    
    t = '\n'.join(t.to_markdown() for t in tables)
    r = '\n'.join(r.to_markdown() for r in relationships)
    return '{}\n{}'.format(t, r)
1085657
def determine_markdown_renderer
      @markdown = if installed?('github/markdown')
        GitHubWrapper.new(@content)
      elsif installed?('redcarpet/compat')
        Markdown.new(@content, :fenced_code, :safelink, :autolink)
      elsif installed?('redcarpet')
        RedcarpetCompat.new(@content)
      elsif installed?('rdiscount')
        RDiscount.new(@content)
      elsif installed?('maruku')
        Maruku.new(@content)
      elsif installed?('kramdown')
        Kramdown::Document.new(@content)
      elsif installed?('bluecloth')
        BlueCloth.new(@content)
      end
    end
364696
function(files, metalsmith, done){
            var yuiDocsData = require('../docs/data.json');

            var makeUrl = function(docClass, method){
                var out = '/docs/classes/' + docClass + '.html';
                if(method){
                    out += '#method_' + method;
                }
                return out;
            };

            for(var key in files){
                var file = files[key];
                if(file.docs_class){
                    file.yui_class_data = yuiDocsData.classes[file.docs_class];
                    if(file.docs_method){
                        file.yui_method_url = makeUrl(file.docs_class) + '#method_' + file.docs_class;
                    }
                }
                var relatedDocs = file.related_methods;
                var relatedDocsFormatted = [];
                if(relatedDocs){
                    relatedDocs.forEach(function(doc){
                        if(doc.indexOf('.') !== -1){
                            var arr = doc.split('.');
                            relatedDocsFormatted.push({
                                name: arr[0] + '.prototype.' + arr[1] + '()',
                                class: arr[0],
                                method: arr[1],
                                url: makeUrl(arr[0], arr[1])
                            });
                        } else {
                            relatedDocsFormatted.push({
                                name: doc + '()',
                                class: doc,
                                url: makeUrl(doc)
                            });
                        }
                    });
                    file.related_docs = relatedDocsFormatted;
                }
            }
            done();
        }
491236
function getMarkupSnippetsCompletions(editor, prefix) {
	const syntax = detectSyntax(editor);

	if (!completionsCache.has(syntax)) {
		// Create cache with Emmet snippets completions
		const registry = createSnippetsRegistry(syntax);
		const field = (index, placeholder) => placeholder || '';
		const completions = registry.all({type: 'string'}).map(snippet => ({
			text: snippet.key,
			type: 'snippet',
			rightLabel: expandAbbreviation(snippet.value, editor, { syntax, field })
		}));

		completionsCache.set(syntax, completions);
	}

	let completions = completionsCache.get(syntax);

	if (prefix) {
		completions = completions.filter(completion => completion.text.indexOf(prefix) === 0);
	}

	return completions.map(completion => Object.assign({ replacementPrefix: prefix }, completion));
}
387989
function plugin() {
	return function (files, metalsmith, done) {
		Object.keys(files).forEach(function (file) {
			setImmediate(done);

			var pathslash = process.platform === 'win32' ? '\\' : '/';
			var rootPath = '';

			var levels = needles(file, pathslash);
			for (var i = 0; i < levels; i++) {
				rootPath += '../';
			}
			files[file].rootPath = rootPath;
		});
	};
}
1104024
function createHtmlWebpackPluginHooks () {
  return {
    beforeAssetTagGeneration: new AsyncSeriesWaterfallHook(['pluginArgs']),
    alterAssetTags: new AsyncSeriesWaterfallHook(['pluginArgs']),
    alterAssetTagGroups: new AsyncSeriesWaterfallHook(['pluginArgs']),
    afterTemplateExecution: new AsyncSeriesWaterfallHook(['pluginArgs']),
    beforeEmit: new AsyncSeriesWaterfallHook(['pluginArgs']),
    afterEmit: new AsyncSeriesWaterfallHook(['pluginArgs'])
  };
}
1175797
function updatePreview (editor, converter) {
    var preview = $('.rendered-markdown');
    //May want to update TOC here too
    toc.generateHeaders(editor);
    preview.html (converter.makeHtml (addSpaces(editor.getValue ())));
    updateWordCount (editor);

  }
381877
def markdown2html(markdown_text):
    '''
    
    '''
    html = markdown.markdown(
        markdown_text,
        extensions=[
            WikiLinkExtension(base_url='/wiki/', end_url=''),
            'markdown.extensions.extra',
            'markdown.extensions.toc',
            'markdown.extensions.codehilite',
            'markdown.extensions.meta'
        ]
    )
    han_biaodians = ['。', '，', '；', '、', '！', '？']
    for han_biaodian in han_biaodians:
        html = html.replace(han_biaodian + '\n', han_biaodian)
    return tornado.escape.xhtml_escape(html)
1031835
function injectPluginProvider(markup) {
  const componentRegex = /<([A-Z][A-Za-z]+)/;

  let match = componentRegex.exec(markup);

  while (match) {
    markup = markup.replace(
      componentRegex,
      "<pluginprovider name=!{'$1'!} plugins=!{props.plugins!}"
    );
    match = componentRegex.exec(markup);
  }

  return markup;
}
90946
def markdown(text)
      renderer = HTMLwithPygments.new(hard_wrap: true, filter_html: false, with_toc_data: false)
      options = {
        autolink: true,
        no_intra_emphasis: true,
        fenced_code_blocks: true,
        lax_html_blocks: true,
        tables: true,
        strikethrough: true,
        superscript: true,
        xhtml: true
      }
      Redcarpet::Markdown.new(renderer, options).render(text).html_safe
    end