A Showdown extension is a function that returns an array of language or outputs extensions (henceforth called "sub-extensions"). ```js var myext = function () { var myext1 = { type: 'lang', regex: /markdown/g, replace: 'showdown' }; var myext2 = { /* extension code */ }; return [myext1, myext2]; } ``` Each sub-extension (`myext1` and `myext2` in the example above) should be an object that defines the behavior of the corresponding sub-extension. ## Sub-extension object properties A sub-extension object should have a [`type` property](#type) that defines the type of the sub-extension, and either [`regex` and `replace` properties](#regex-and-replace) or a [`filter` property](#filter). ### Type **Type** is a **required** property that defines the nature of the corresponding sub-extensions. It takes one of the two values: * **`lang`**: language extension to add new Markdown syntax to Showdown. `lang` extensions have the **highest priority** in the subparser order, so they are called after [escaping and normalizing](#escape-and-normalization) the input text and before calling any other subparser (or extension). !!! example "When to use `lang` type" For example, if you want the `^^youtube http://www.youtube.com/watch?v=oHg5SJYRHA0` syntax to automatically be rendered as an embedded YouTube video. * **`output`**: output extension (or modifier) to alter the HTML output generated by Showdown. `output` extensions have the **lowest priority** in the subparser order, so they are called right before the cleanup step and after calling all other subparsers. !!! example "When to use `output` type" For example, if you want the `