<template>
  <ul>
    <slot
        v-for="page of []
        .filter(page => page.regularPath.match(new RegExp(`^${ path }.`)))
        .slice(0, limit)
      "
        :page="page"
    >
      <li>
        <router-link :to="page.regularPath">{{ page.title }}</router-link>
      </li>
    </slot>
  </ul>
</template>

<script>
export default {
  name: "TableOfContents",
  props: {
    path: String,
    limit: {
      type: Number,
      default: 8,
    },
  },
};
</script>