Skip to content

Commit 69c5471

Browse files
authored
Adding to MD docs Yaml meta settings: hidden, noviewall that work. Adding for future use: order, tags, links. (#137)
1 parent d703ad2 commit 69c5471

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/PatternLab/PatternData/Rules/DocumentationRule.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,24 @@ public function run($depth, $ext, $path, $pathName, $name) {
8080
"meta" => $yaml,
8181
"full" => $doc);
8282

83+
// can set `title: My Cool Pattern` instead of lifting from file name
8384
if (isset($title)) {
8485
$patternStoreData["nameClean"] = $title;
8586
}
8687

87-
if (isset($yaml["state"])) {
88-
$patternStoreData["state"] = $yaml["state"];
88+
$availableKeys = [
89+
'state', // can use `state: inprogress` instead of `[email protected]`
90+
'hidden', // setting to `true`, removes from menu and viewall, which is same as adding `_` prefix
91+
'noviewall', // setting to `true`, removes from view alls but keeps in menu, which is same as adding `-` prefix
92+
'order', // @todo implement order
93+
'tags', // not implemented, awaiting spec approval and integration with styleguide kit. adding to be in sync with Node version.
94+
'links', // not implemented, awaiting spec approval and integration with styleguide kit. adding to be in sync with Node version.
95+
];
96+
97+
foreach ($availableKeys as $key) {
98+
if (isset($yaml[$key])) {
99+
$patternStoreData[$key] = $yaml[$key];
100+
}
89101
}
90102

91103
// if the pattern data store already exists make sure this data overwrites it

0 commit comments

Comments
 (0)