saberland/saber

Do you want to work on this issue?

You can request for a bounty in order to promote it!


1 active bounty request

$40.00
Solve someone else's bounty request by clicking on it and completing the funding to earn additional credits

Template feature: replace tags with Vue components #472

egoist posted onGitHub

<!-- Please don't delete this template or we'll close your issue -->

<!-- Before creating an issue please make sure you are using the latest version of Saber. -->

Feature request

<!-- Please ask questions via following several ways. -->

<!-- https://chat.saber.land/ -->

<!-- https://stackoverflow.com/questions/ask?tags=saberjs -->

In:

## hello

this is a test

With saber-config.js:

module.exports = {
  template: {
    tags: {
      h1: {
        component: 'md-heading',
        // Optionally map token to props
        props: token => ({ level: parseInt(token.tag) })
      }
    }
  }
}

Out:

<md-heading :level="2">hello</md-heading>

<p>this is a test</p>

What problem does this feature solve?

You like the simplicity of Markdown but also want the power of Vue components.


Seems pretty nifty. Maybe we could combine this with something similar to Hexo's tag plugins.

Also I think it would be nice if plugins could register custom Markdown components.

posted by krmax44 over 5 years ago

@krmax44 If you're fine with syntax like {% blockquote [author[, source]] [link] [source_link_title] % why not use Vue components directly šŸ¤”

posted by egoist over 5 years ago

@krmax44 If you're fine with syntax like {% blockquote [author[, source]] [link] [source_link_title] % why not use Vue components directly thinking

Because I like the ""simplicity"" of Markdown but also want the power of Vue components. Ok maybe not the prettiest syntax in the world, but for folks migrating their Hexo content/are used to it or that just want to keep cody things like <my-blockquote-component> out of their Markdown for whatever reason, which are probably the same people that prefer # hello over <md-heading>hello</md-heading>, it might be nice.

A better syntax might be:

@[my-component](sup)

@[my-component](args) {
## Block style

so much content
}

or...

@[my-component](args)
...
@[/my-component]

or Saber style...

āš”ļø[my-component](args)
...
āš”ļø[/my-component](args)
posted by krmax44 over 5 years ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests