Skip to content

Instantly share code, notes, and snippets.

@miebach
Created June 14, 2010 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miebach/437163 to your computer and use it in GitHub Desktop.
Save miebach/437163 to your computer and use it in GitHub Desktop.
function remove_surrounding_p_tag(s) {
//converts '<p>xyz</p>' to 'xyz', good for showdown
return s.replace(/^<p>|<\/p>$/g,"");
}
@miebach
Copy link
Author

miebach commented Jun 14, 2010

When you call the showdown / markdown converter (http://github.com/kriskowal/markdown), it will surround the resulting code with additional <p>..</p> tags. If you want to remove them afterwards you can use this function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment