PyEmbed allows you to control exactly how content is renderer by supplying a custom renderer. There are supported renderers that allow you to write templates for your embeddings using Mustache or Jinja2, or you can write your own renderer.

Using a renderer


If you're using PyEmbed directly, you can specify a custom renderer as follows:

>>> html = PyEmbed(renderer=renderer).embed(url)


You can pass a custom renderer directly to the Markdown extension:

>>> html = markdown.markdown(text, extensions=[PyEmbedMarkdown(renderer=renderer)])


You can pass a custom renderer directly to the reStructuredText extension:

>>> PyEmbedRst(renderer=renderer).register()
>>> html = publish_string(text)

Creating a custom renderer

If you want to create your own renderer, you should extend the PyEmbedRenderer class, overriding the render method.