docs: def create_page(self, build_dir, filepath, context={}, content=None, template=None, markup=None, layout=None):
          """
          To dynamically create a page and save it in the build_dir
          :param build_dir: (path) The base directory that will hold the created page
          :param filepath: (string) the name of the file to create. May  contain slash to indicate directory
                          It will also create the url based on that name
                          If the filename doesn't end with .html, it will create a subdirectory
                          and create `index.html`
                          If file contains `.html` it will stays as is
                          ie:
                              post/waldo/where-is-waldo/ -> post/waldo/where-is-waldo/index.html
                              another/music/new-rap-song.html -> another/music/new-rap-song.html
                              post/page/5 -> post/page/5/index.html
          :param context: (dict) context data
          :param content: (text) The content of the file to be created. Will be overriden by template
          :param template: (path) if source is not provided, template can be used to create the page.
                           Along with context it allows to create dynamic pages.
                           The file is relative to `/templates/`
                           file can be in html|jade|md
          :param markup: (string: html|jade|md), when using content. To indicate which markup to use.
                          based on the markup it will parse the data
                          html: will render as is
                          jade and md: convert to the appropriate format
          :param layout: (string) when using content. The layout to use.
                          The file location is relative to `/templates/`
                          file can be in html|jade|md
          :return:
          """
  
          build_dir = build_dir.rstrip("/")
          filepath = filepath.lstrip("/").rstrip("/")
          if not filepath.endswith(".html"):
              filepath += "/index.html"
          dest_file = os.path.join(build_dir, filepath)
          dest_dir = os.path.dirname(dest_file)
  
          if not os.path.isdir(dest_dir):
              os.makedirs(dest_dir)
  
          _context = context
          if "page" not in _context:
              _context["page"] = self.default_page_meta.copy()
          if "url" not in _context["page"]:
              _context["page"]["url"] = "/" + filepath.lstrip("/").replace(
                  "index.html", "")
  
          if template:
              if template not in self._templates:
                  self._templates[template] = self.tpl_env.get_template(template)
              tpl = self._templates[template]
          else:
              if markup == "md":
                  _context["page"]["__toc__"] = md.get_toc(content)
                  content = md.convert(content)
              elif markup == "jade":
                  content = jade.convert(content)
  
              # Page must be extended by a layout and have a block 'body'
              # These tags will be included if they are missing
              if re.search(self.RE_EXTENDS, content) is None:
                  layout = layout or self.default_layout
                  content = "\n{% extends '{}' %} \n\n".replace("{}",
                                                                layout) + content
  
              if re.search(self.RE_BLOCK_BODY, content) is None:
                  _layout_block = re.search(self.RE_EXTENDS, content).group(0)
                  content = content.replace(_layout_block, "")
                  content = "\n" + _layout_block + "\n" + \
                            "{% block body %} \n" + content.strip() + "\n{% endblock %}"
  
              tpl = self.tpl_env.from_string(content)
  
          with open(dest_file, "w") as fw:
              fw.write(tpl.render(**_context))