Skip to content

Instantly share code, notes, and snippets.

@gossi
Last active April 6, 2021 11:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gossi/53d1b14b6f8340b188887dbd98a2dafe to your computer and use it in GitHub Desktop.
Save gossi/53d1b14b6f8340b188887dbd98a2dafe to your computer and use it in GitHub Desktop.
Ember Single File Component (markdown approach)

Ember Single File Component (markdown approach)

A syntax we are widely used to write is markdown, which also has a syntax to write blocks of code. In this variant of a potential SFC thingy, the only allowed "top-level-syntaxes" are code blocks. Based on the language they are assigned script, template or style. Everything other than code blocks is ignored (= comment)

References

title
Foo

Hello I'm just documentation here with mdjs like notation to the code snippets

import Component from '@glimmer/component';
import Button from './button.embr';

interface TextInputArgs {
  value: unknown;
  update: (value: unknown) => void;
}

export default class TextInputComponent extends Component<TextInputArgs> {
}

I am another documentation section here

<input value={{@value}} {{on "input" @update}} local-class="foo"/>
<Button>Go</Button>

Look I even got styles

.foo {
  background-color: blue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment