:: StoryData
{
	"ifid":"A1B71AA6-BD68-4DE8-A56F-7F287516BDF9"
}

:: StoryTitle
Enhancing Markdown Output in Snowman

:: UserScript[script]
/*
	Post-process the already-rendered Markdown output after each passage is
	shown, instead of trying to reconfigure the internal Markdown renderer.
*/
$(document).on('sm.passage.shown', function () {
	// Make Markdown-generated links to other sites open safely in a new tab.
	$('tw-passage a[href^="http"]').attr('target', '_blank').attr('rel', 'noopener noreferrer');

	// Label fenced code blocks generated by Markdown.
	$('tw-passage pre code').each(function () {
		var $pre = $(this).parent();
		if ($pre.prev('.code-label').length === 0) {
			$('<div class="code-label">Code:</div>').insertBefore($pre);
		}
	});
});

:: Start
Check out [the Snowman repository](https://github.com/videlais/snowman) to learn more.

```
console.log("hello");
```
