-
Notifications
You must be signed in to change notification settings - Fork 3
Formally declare markdown with yaml as Pattern Meta (patternMeta
) #34
Description
Each *.md
has been consider "Documentation" and appears in various ways to tell more about the pattern. Originally, changing the file name of the pattern informed pattern lab about it: _pattern.twig
to hide it, -pattern.twig
to only show in menu, [email protected]
to show state. Those all are less than ideal as not only are they cryptic and limited, but systems outside of Pattern Lab that don't understand the Pattern Lab Partial Syntax get thrown off by files constantly having to be renamed. Here is what I'm proposing for being able to go into a Pattern Meta markdown file:
---
title: My title
state: inprogress
hidden: true
noviewall: true
order: 5
tags:
- products
- teasers
annotations:
-
title: Masthead
element: .c-header
annotation: The main header of the site doesn't take up too much screen real estate in order to keep the focus on the core content. It's using a linear CSS gradient instead of a background image to give greater design flexibility and reduce HTTP requests.
links:
-
label: Demo
url: "#"
-
label: Article
url: "#"
-
label: Source
url: "#"
---
My *super* cool markdown description...
OK, there's a lot there, let's break it down:
title
- Overrides pattern name derived from file name.- Already implemented in PHP & Node
state
- Sets state. Replaces appending@inprogress
to filename.- Was how Node version did it already
- PHP version updated to this method this week at
v2.8.4
.
hidden
- Hides pattern everywhere aka prepending_
to filename.- Implemented in PHP version this week at
v2.8.4
- Implemented in PHP version this week at
noviewall
- Hides pattern from View All lists, but keeps in menu aka prepending-
to filename.- Added this week in PHP at
v2.8.4
- Added this week in PHP at
order
- Order of pattern, would replace prepending filename by05-
.- Not done in PHP (issue here)
tags
- Arbitrary tags for whatever the future may hold.annotations
- Discussed very recently over in Move annotations to markdown file #33links
- Collection of links - useful as they would all requiretarget="_blank"
ortarget="_parent"
to work correctly in the<iframe>
and covers all sorts of Jira ticket, documentation, or inspiration article scenarios one would want.
Again, a lot there, but I wanted to summarize the best I could. I'm down to narrow that down a bit or whatever, but I think it's a good idea to say: "this is where we keep information about the pattern itself". Since everything *.yml
/ *.json
is all about data passed to the pattern, I think it'd be best to do it this way.
Additionally, I think that we should create a JSON Schema that defines this data model that both PHP & Node could pull into validate.
I know a lot of discussion has gone on around this already, but I've done my best to aggregate it all. I'd love to see this in the PL Docs as "Pattern Meta" and under the hood in PHP/Node as patternMeta
with the same structure.
Thoughts? Am I missing anything?
Related Issues
- Implement better ordering patternlab-php-core#138
- Move annotations to markdown file #33
- Discussion and Vote: Pattern State Declaration, and other Pattern Metadata #16
- Discussion & Vote: Pattern Type Documentation #28
Related code blocks
- Node passing data from MD files -
pattern_assembler.js
/cc @pattern-lab/voting-members