pattern-lab / patternlab-php-core

This repository provides the core functionality for Pattern Lab. It is meant to be used from within an Edition with a PatternEngine and StarterKit.
http://patternlab.io/
MIT License
43 stars 62 forks source link

DPL: Compile Templates Embedded in Markdown Files #126

Open sghoweri opened 7 years ago

sghoweri commented 7 years ago

Original pull request from the Drupal Pattern Lab Fork which already merged in these 9 previous PRs.

You know the thing that really sucks about documenting your growing design system? When your docs you spent so much time putting together get out of sync with your source of truth. Again.

Wouldn't it be amazing if we could just use the same data and the same templates being put INTO the system to DOCUMENT the system itself? What's that? I already put a PR in for that on the original Pattern Lab PHP Core repo... 10 months ago? Oh snap!

In all seriousness, this is a major feature we've been seriously lacking in Pattern Lab's markdown docs approach for forever. This PR should fix that by letting you use the same templates and same data as you would with any other pattern in Pattern Lab, but in your markdown files.

Testing this out locally seems to be working as expected (global data trickling through, local data overriding global data if it exists, and pattern includes w/ namespaces) -- all seem to be working perfectly at first glance!

Before: image

After: image

Practical Usage Example: image image

CC @EvanLovely @evanmwillhite @jesconstantine @aleksip @bradfrost