algolia / frontman

💎 A Ruby-based static website generator
https://rubygems.org/gems/frontman-ssg
MIT License
109 stars 4 forks source link

Create a Markdown extension #17

Open sarahdayan opened 4 years ago

sarahdayan commented 4 years ago

Description

A simplified markup language that lets you leverage Ruby functions and partials with a more Markdown-like syntax.

Motivation

We currently provide a way for users to mix different rendering languages. This is nice and should stay, but it would be even better to have a unified language that lets you leverage ERB with a Markdown-like syntax. This is more user friendly for writers, and allows you to lint content with tools like stylelint without having to write a custom parser.

Solution

We could extend Markdown to develop a few tags that let users leverage Ruby features without actually writing ERB.

For example:

# Before

<%= partial 'panel/table.haml', locals: {
  data: {
    'Group title': [
      {
        text: 'My title',
        link: '/path/to/page/'
      }
    ],
  }
} %>
// After

<panel-table groups="[{ text: 'My title', link: '/path/to/page/' }]" />