Skip to content

Commit 9468efe

Browse files
committed
Scope MD styles with a class
1 parent d2453ba commit 9468efe

File tree

14 files changed

+105
-75
lines changed

14 files changed

+105
-75
lines changed

addon/components/docs-hero/component.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import layout from './template';
33

44
/**
55
A component that renders a hero banner. Useful for your docs site's homepage.
6+
67
@class DocsHero
78
@public
89
*/

addon/components/docs-keyboard-shortcuts/component.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { EKMixin, keyUp } from 'ember-keyboard';
66
import { inject as service } from '@ember/service';
77

88
/**
9-
A component that renders a hero banner. Useful for your docs site's homepage.
9+
A component that enables keyboard shortcuts. Press '?' to toggle the keyboard shortcuts dialog.
10+
1011
@class DocsKeyboardShortcuts
1112
@public
1213
*/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import LinkComponent from '@ember/routing/link-component';
2+
3+
/**
4+
Just a styled subclass of LinkComponent. Comes in handy when rending links in Markdown templates:
5+
6+
```md
7+
Here I am, telling you about {{docs-link 'another page' 'docs.x-foo'}}
8+
```
9+
10+
@class DocsLink
11+
@public
12+
*/
13+
export default LinkComponent.extend({
14+
15+
classNames: 'docs-md__a'
16+
17+
});

addon/styles/addon.scss

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,39 +71,26 @@ button {
7171
font-size: 16px;
7272
-webkit-font-smoothing: antialiased;
7373

74-
h2 {
74+
&__h2 {
7575
font-size: 24px;
7676
font-weight: 600;
7777
margin-top: 1.5em;
7878
}
7979

80-
p {
81-
}
82-
83-
li {
84-
}
85-
86-
code {
80+
&__code {
8781
background: $code-background-color;
8882
}
8983

90-
blockquote {
84+
&__blockquote {
9185
margin: 0;
9286
margin-bottom: .85em;
9387
padding: 0 15px;
9488
color: #858585;
9589
border-left: 4px solid #e5e5e5
9690
}
9791

92+
// Couldn't figure out how to add class in our Renderer
9893
aside {
99-
// right side version
100-
// font-size: small;
101-
// width: 180px;
102-
// position: absolute;
103-
// left: 780px;
104-
// line-height: 1.4;
105-
106-
// inline version
10794
background: #fafafa;
10895
padding: 10px 20px;
10996
margin-top: 20px;
@@ -118,7 +105,7 @@ button {
118105
font-size: 14px;
119106
}
120107

121-
a {
108+
&__a {
122109
text-decoration: none;
123110
border-bottom: 1px solid #ccc;
124111
color: inherit;
@@ -128,7 +115,7 @@ button {
128115
}
129116
}
130117

131-
hr {
118+
&__hr {
132119
height: 4px;
133120
padding: 0;
134121
margin: 1.7em 0;

app/components/docs-link.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from 'ember-cli-addon-docs/components/docs-link/component';

lib/utils/compile-markdown.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,20 @@ class HBSRenderer extends marked.Renderer {
4444
.replace(/{{/g, '{{')
4545
.replace(/}}/g, '}}');
4646
}
47+
48+
heading(text, level) {
49+
return `<h${level} class='docs-md__h${level}'>${text}</h${level}>`;
50+
}
51+
52+
hr() {
53+
return `<hr class='docs-md__hr'>`;
54+
}
55+
56+
blockquote(text) {
57+
return `<blockquote class='docs-md__blockquote'>${text}</blockquote>`;
58+
}
59+
60+
link(href, title, text) {
61+
return `<a href="${href}" title="${title}" class="docs-md__a">${text}</a>`;
62+
}
4763
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{#docs-snippet name="docs-snippet"}}
2+
<div id='foo'>
3+
{{#my-awesome-thing
4+
some=true
5+
options=false}}
6+
<p>Something old, something new</p>
7+
{{/my-awesome-thing}}
8+
</div>
9+
{{/docs-snippet}}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{#docs-snippet name="my-snippet-src"}}
2+
// BEGIN-SNIPPET my-snippet
3+
App = Ember.Application.extend({
4+
modulePrefix: config.modulePrefix,
5+
podModulePrefix: config.podModulePrefix,
6+
Resolver
7+
});
8+
// END-SNIPPET
9+
{{/docs-snippet}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{#docs-snippet name="my-snippet-src2"}}
2+
{{docs-snippet name='my-snippet.js'}}
3+
{{/docs-snippet}}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{#docs-snippet name="docs-snippet-title-example" title="app/components/my-component.js"}}
2+
import Component from '@ember/component';
3+
export default Component.extend({
4+
// ...
5+
});
6+
{{/docs-snippet}}

0 commit comments

Comments
 (0)