Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding arbitrary code samples to patterns #90

Open
yodasw16 opened this issue Sep 12, 2016 · 2 comments
Open

Adding arbitrary code samples to patterns #90

yodasw16 opened this issue Sep 12, 2016 · 2 comments

Comments

@yodasw16
Copy link

Is there a way to add arbitrary code samples to a pattern template? A few examples:

  • to show different markup than what is rendered above the markup sample
  • to show both the markup that renders the pattern and some additional markup that isn't rendered
  • to share the CSS for a pattern
@erikjung
Copy link
Contributor

@yodasw16 We have also experienced the need for this kind of flexibility.

Are you thinking that this would be a new property defined in the front-matter of a pattern with the arbitrary code provided as a fenced code block?

As a temporary workaround, you can always include code samples within the notes front-matter property (since it is parsed as Markdown), and use the sourceless flag to hide the default code sample. Example:

name: Button
sourceless: true
notes: |
  This is a button. Here is some code:
  ```html
  <button class="Button">Wooo</button>
  ```
  ```css
  .Button { }
  ```

Although you may need to add a little CSS to properly style the <pre> and/or <code> elements output by the Markdown engine.

@yodasw16
Copy link
Author

Yeah, I think it would have to either be a property in the front-matter or for things like showing css or js maybe having another file in the directory that get's pulled in to another <pre><code>. Not sure how that would work, but it would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants