docs: def render_markdown(post):
          """
          Renders the post as Markdown using the template specified in :attr:`markdown_template_path`.
          """
          from engineer.conf import settings
  
          # A hack to guarantee the YAML output is in a sensible order.
          # The order, assuming all metadata should be written, should be:
          # title
          # status
          # timestamp
          # link
          # via
          # via-link
          # slug
          # tags
          # updated
          # template
          # content-template
          # url
          d = [
              ('status', post.status.name),
              ('link', post.link),
              ('via', post.via),
              ('via-link', post.via_link),
              ('tags', post.tags),
              ('updated', post.updated_local.strftime(settings.TIME_FORMAT) if post.updated is not None else None),
              ('template', post.template if post.template != 'theme/post_detail.html' else None),
              ('content-template',
               post.content_template if post.content_template != 'theme/_content_default.html' else None),
          ]
  
          # The complete set of metadata that should be written is the union of the FINALIZE_METADATA.config setting and
          # the set of metadata that was in the file originally.
          finalization_config = FinalizationPlugin.get_settings()['config']
          metadata_to_finalize = set([m for m, s in finalization_config.iteritems() if post.status in s])
          metadata_to_finalize.update(post.metadata_original)
  
          if 'title' in metadata_to_finalize:
              # insert at the top of the list
              d.insert(0, ('title', post.title))
          if 'slug' in metadata_to_finalize:
              # insert right before tags
              d.insert(d.index(('tags', post.tags)), ('slug', post.slug))
          if 'timestamp' in metadata_to_finalize:
              # insert right after status
              d.insert(d.index(('status', post.status.name)), ('timestamp',
                                                               post.timestamp_local.strftime(settings.TIME_FORMAT)))
          if 'url' in metadata_to_finalize:
              # insert at end of list
              d.append(('url', post.url))
  
          metadata = ''
          for k, v in d:
              if v is not None and len(v) > 0:
                  metadata += yaml.safe_dump(dict([(k, v)]), default_flow_style=False)
  
          # handle custom metadata
          if len(post.custom_properties):
              metadata += '\n'
              metadata += yaml.safe_dump(dict(post.custom_properties), default_flow_style=False)
          return settings.JINJA_ENV.get_template(post.markdown_template_path).render(metadata=metadata,
                                                                                     content=post.content_finalized,
                                                                                     post=post)