Skip to content

๐Ÿ“ Markdown as First-Class Route Content โ€‹

With WBC-Routes2, you can directly route to Markdown content โ€” whether from local files, external URLs, or even embedded inline Markdown strings. This makes documentation-centric or content-heavy Vue applications lightning fast to build and extend.


๐Ÿ”น Local Markdown File as Route Content โ€‹

Serve a local .md file from the public/ or src/ directory using:

js
{
  path: "/markdown/introduction",
  name: "MarkdownIntro",
  component: WBC,
  props: {
    item: "./docs/intro.md"
  }
}

๐Ÿ“Œ The file path must be relative to your public assets or your Vite/static folder.


๐Ÿ”ธ Inline Markdown Snippet โ€‹

Embed Markdown inline using the MD__ prefix:

js
{
  path: "/markdown/inline",
  name: "MarkdownInline",
  component: WBC,
  props: {
    item: "MD__# This is a Markdown Header"
  }
}

โœ… This content will be rendered dynamically as Vue interpretable Markdown.


๐Ÿ”ธ Array of Markdown Sections โ€‹

Multiple markdown blocks can be rendered with:

js
{
  path: "/markdown/array",
  name: "MarkdownArray",
  component: WBC,
  props: {
    item: [
      "MD__# Section 1",
      "MD__- Bullet 1",
      "MD__- Bullet 2",
      "MD__# Section 2",
      "./docs/details.md"
    ]
  }
}

๐Ÿš€ This is particularly useful for structured pages built from both static and dynamic content.


๐Ÿงช Markdown with Reactive or Dynamic Logic โ€‹

You can inject JavaScript logic within Markdown using WBCโ€™s JS-eval compatibility:

js
{
  path: "/markdown/dynamic",
  name: "MarkdownDynamic",
  component: WBC,
  props: {
    item: {
      comp: "MD",
      dive: true,
      options: {
        html: "MD__## Hello ``{this.userName || 'Guest'}",
        on: {
          mounted: that => {
            that.userName = 'Wissem';
          }
        }
      }
    }
  }
}

๐Ÿง  This enables personalization, conditional text, and dynamic labels in Markdown.


๐Ÿ” Mixed Markdown and HTML โ€‹

You can mix raw HTML with Markdown using either:

  • Markdown src + html fallback
  • WBHtml injection blocks (<~div>, li__Text|color, etc.)

Example:

js
{
  path: "/markdown/mixed",
  name: "MarkdownMixed",
  component: WBC,
  props: {
    item: {
      comp: "MD",
      options: {
        html: [
          "<~ol>", "<li>",
          "MD__### Inline Header",
          "<div class='tip'>Custom HTML block with class</div>"
        ],
        src: "# Top Title\n\n- List item A\n- List item B"
      }
    }
  }
}

โœ… Summary โ€‹

Use CaseMethod
Load from .md fileRelative file path in item
Inline snippetString starting with MD__
Multiple fragmentsArray of MD__, files, or components
Interactive logicUse dive:true with dynamic bindings
Markdown + HTMLCombine with src and html in options