Skip to content

Commit 46a7bdf

Browse files
authored
Merge pull request #902 from ember-learn/markdown
use ember-showdown-shiki
2 parents f38cbcb + cf5daf8 commit 46a7bdf

File tree

10 files changed

+209
-247
lines changed

10 files changed

+209
-247
lines changed

app/components/class-field-description.hbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@
5454
<div class='parameter'>
5555
<dt>{{param.name}}</dt>
5656
<dd class='parameter-type'>{{param.type}}</dd>
57-
<dd>{{param.description}}</dd>
57+
<dd><MarkdownToHtml @markdown={{param.description}} /></dd>
5858
{{#if param.props}}
5959
<dl class='parameters'>
6060
{{#each param.props as |prop|}}
6161
<div class='prop'>
6262
<dt>{{prop.name}}</dt>
6363
<dd class='parameter-type'>{{prop.type}}</dd>
64-
<dd>{{prop.description}}</dd>
64+
<dd><MarkdownToHtml @markdown={{prop.description}} /></dd>
6565
</div>
6666
{{/each}}
6767
</dl>
@@ -72,9 +72,9 @@
7272
<div class='return'>
7373
<dt>returns</dt>
7474
<dd class='return-type'>{{@field.return.type}}</dd>
75-
<dd>{{@field.return.description}}</dd>
75+
<dd><MarkdownToHtml @markdown={{@field.return.description}} /></dd>
7676
</div>
7777
{{/if}}
7878
</dl>
79-
{{html-safe @field.description}}
79+
<MarkdownToHtml @markdown={{@field.description}} />
8080
</section>

app/components/import-example.hbs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
1-
<div class='highlight javascript'>
2-
<div class='ribbon'></div>
3-
{{#if (is-clipboard-supported)}}
4-
<div class='import-copy'>
5-
{{#if this.showClipboardSuccessIcon}}
6-
{{svg-jar 'success' width='24px' height='24px'}}
7-
{{else}}
8-
<CopyButton @clipboardText={{concat 'import ' @item " from '" @package "';"}} @title='Copy to clipboard' @success={{this.showSuccess}}>
9-
{{svg-jar 'copy' width='24px' height='24px'}}
10-
</CopyButton>
11-
{{/if}}
12-
</div>
13-
{{/if}}
14-
<table class='CodeRay'>
15-
<tbody>
16-
<tr>
17-
<td class='code'><pre><span class='wrapper'><span class='keyword'>import</span> {{@item}} <span class='keyword'>from</span> <span class='string'>'{{@package}}'</span>;</span></pre></td>
18-
</tr>
19-
</tbody>
20-
</table>
21-
</div>
1+
<MarkdownToHtml @markdown={{this.markdown}} />

app/components/import-example.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
import { action } from '@ember/object';
21
import Component from '@glimmer/component';
3-
import { later } from '@ember/runloop';
4-
import { tracked } from '@glimmer/tracking';
52

63
export default class ImportExample extends Component {
7-
@tracked showClipboardSuccessIcon = false;
8-
9-
@action
10-
showSuccess() {
11-
this.showClipboardSuccessIcon = true;
12-
later(this, () => (this.showClipboardSuccessIcon = false), 950);
4+
get markdown() {
5+
let md = `\`\`\`js
6+
import ${this.args.item} from '${this.args.package}';
7+
\`\`\``;
8+
return md;
139
}
1410
}

app/styles/components/_all.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
@import "sidebar";
44
@import "article";
55
@import "back-to-top";
6-
@import "highlight";
76
@import "toc";
87
@import "old-version-warning";
98
@import "whoops";

app/styles/components/_highlight.scss

Lines changed: 0 additions & 204 deletions
This file was deleted.

app/templates/project-version/classes/class.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
{{#if (and (not (eq this.static 1)) this.hasImportExample)}}
6464
<ImportExample @item={{@model.name}} @package={{this.module}} />
6565
{{/if}}
66-
<p class="description">{{html-safe @model.description}}</p>
66+
<p class="description"><MarkdownToHtml @markdown={{@model.description}} /></p>
6767

6868
{{#if (or @model.methods @model.properties @model.events)}}
6969
<div class="tabbed-layout">

app/templates/project-version/modules/module.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{{/if}}
1616
</p>
1717

18-
<p class="description">{{html-safe this.model.description}}</p>
18+
<p class="description"><MarkdownToHtml @markdown={{this.model.description}} /></p>
1919

2020
{{#if this.submodules}}
2121
<section>

config/fastboot.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = function () {
2+
return {
3+
buildSandboxGlobals(defaultGlobals) {
4+
return Object.assign({}, defaultGlobals, {
5+
atob: atob,
6+
});
7+
},
8+
};
9+
};

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"test": "tests"
1414
},
1515
"scripts": {
16-
"clone": "rm -rf ember-api-docs-data && git clone --depth=1 https://github.com/ember-learn/ember-api-docs-data.git",
16+
"clone": "rm -rf ember-api-docs-data && git clone -b markdown --depth=1 https://github.com/ember-learn/ember-api-docs-data.git",
1717
"build": "ember build --environment=production",
1818
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
1919
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
@@ -83,6 +83,7 @@
8383
"ember-cli-inject-live-reload": "^2.1.0",
8484
"ember-cli-meta-tags": "^7.0.0",
8585
"ember-cli-sass": "^10.0.1",
86+
"ember-cli-showdown": "^9.0.1",
8687
"ember-cli-terser": "^4.0.2",
8788
"ember-composable-helpers": "^3.1.1",
8889
"ember-concurrency": "^2.3.7",
@@ -100,6 +101,7 @@
100101
"ember-resolver": "^8.0.3",
101102
"ember-rfc176-data": "^0.3.17",
102103
"ember-route-action-helper": "^2.0.5",
104+
"ember-showdown-shiki": "^1.2.1",
103105
"ember-sinon": "^4.1.1",
104106
"ember-source": "~3.28.8",
105107
"ember-styleguide": "^3.3.0",
@@ -131,7 +133,7 @@
131133
"node-sass": "^9.0.0",
132134
"normalize.css": "^8.0.1",
133135
"npm-run-all": "^4.1.5",
134-
"prember": "^2.0.0",
136+
"prember": "^2.1.0",
135137
"prettier": "^2.5.1",
136138
"qunit": "^2.17.2",
137139
"qunit-dom": "^1.6.0",

0 commit comments

Comments
 (0)