-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from universal-ember/support-everything
Add markdown/glimdown rendering, TypeDoc, etc
- Loading branch information
Showing
50 changed files
with
3,129 additions
and
499 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"ignoreRules": ["no-resolution", "cjs-resolves-to-esm"] | ||
"ignoreRules": ["no-resolution", "cjs-resolves-to-esm"], | ||
"excludeEntrypoints": ["webpack", "vite"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import EmberRouter from '@ember/routing/router'; | ||
|
||
import config from 'docs-app/config/environment'; | ||
import { properLinks } from 'ember-primitives/proper-links'; | ||
import { addRoutes } from 'kolay'; | ||
|
||
@properLinks | ||
export default class Router extends EmberRouter { | ||
location = config.locationType; | ||
rootURL = config.rootURL; | ||
} | ||
|
||
Router.map(function () {}); | ||
Router.map(function () { | ||
addRoutes(this); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,38 @@ | ||
// NOTE: this is a virtual module and doesn't actually exist | ||
// the build emits it | ||
import ENV from 'docs-app/config/environment'; | ||
import { pageTitle } from 'ember-page-title'; | ||
import Route from 'ember-route-template'; | ||
|
||
import { Demo } from './demo/logs'; | ||
const Nav = <template> | ||
<ul> | ||
{{#each @item.pages as |page|}} | ||
{{#if page.path}} | ||
<li> | ||
<a href={{page.path}}>{{page.name}}</a> | ||
</li> | ||
{{else}} | ||
<li> | ||
{{page.name}} | ||
<Nav @item={{page}} /> | ||
</li> | ||
{{/if}} | ||
{{/each}} | ||
</ul> | ||
</template>; | ||
|
||
export default Route( | ||
<template> | ||
{{pageTitle ENV.APP.shortVersion}} | ||
|
||
{{outlet}} | ||
<Demo /> | ||
<pre><code>{{JSON.stringify @model.manifest null 3}}</code></pre> | ||
<div class="application__layout"> | ||
<nav> | ||
<Nav @item={{@model.manifest.tree}} /> | ||
</nav> | ||
<main> | ||
{{outlet}} | ||
</main> | ||
</div> | ||
<style> | ||
.application__layout { display: grid; grid-template-columns: max-content 1fr; gap: 1rem; } | ||
</style> | ||
</template> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { service } from 'ember-primitives/helpers'; | ||
import Route from 'ember-route-template'; | ||
import { highlight } from 'kolay'; | ||
|
||
export default Route( | ||
<template> | ||
{{#let (service "kolay/docs") as |docs|}} | ||
<div | ||
data-prose | ||
class="prose p-4" | ||
{{(if docs.selected.prose (modifier highlight docs.selected.prose))}} | ||
> | ||
{{#if docs.selected.hasError}} | ||
<div style="border: 1px solid red; padding: 1rem;"> | ||
{{docs.selected.error}} | ||
</div> | ||
{{/if}} | ||
|
||
{{#if docs.selected.prose}} | ||
<docs.selected.prose /> | ||
{{/if}} | ||
</div> | ||
{{/let}} | ||
</template> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# `<APIDocs />` | ||
|
||
```hbs live | ||
<APIDocs @module="declarations/browser/re-exports" @name="APIDocs" @apiDocs="/docs/kolay.json" /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# `<CommentQuery />` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# `<ComponentSignature />` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# `apiDocs(...)` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# `copyFileToPublic(...)` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# `copyFile(...)` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# `createManifest(...)` | ||
|
||
```hbs live | ||
<APIDocs @module="declarations/plugins/vite" @name="createManifest" @apiDocs="/docs/kolay.json" /> | ||
``` | ||
|
||
```hbs live | ||
<APIDocs @module="src/plugins/types" @name="CreateManifestOptions" @apiDocs="/docs/kolay.json" /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
# Build Plugins | ||
|
||
foo | ||
Kolay requires some build-time static analysis to function. | ||
|
||
[`createManifest(...)`](/plugins/create-manifest.md) is the only required plugin. This generates the navigation and information about how Kolay's runtime code will fetch the markdown documents deployed with the app's static assets. | ||
|
||
Additionally, you may want [`apiDocs(...)`](/plugins/api-docs.md) to render JSDoc information generated from your library's type declarations. Rendering these uses the [Signature Components]() or [`APIDocs`]() components. | ||
|
||
There are also a couple utility plugins that may or may not be useful as you build your documentation app. | ||
|
||
- [copyFile(...)](/plugins/copy-file.md) | ||
- [copyFileToPublic(...)](/plugins/copy-file-to-public.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<h1 style=" | ||
font-size: 2rem; | ||
display: inline-block; | ||
margin-bottom: 0; | ||
padding-bottom: 0">kolay</h1> | ||
<small><code>adjective</code></small> | ||
|
||
<ul style="margin: 0; padding-left: 1rem; padding-bottom: 0;"> | ||
<li>easy</li> | ||
<li>simple</li> | ||
<li>uncomplicated</li> | ||
</ul> | ||
|
||
<small style=" | ||
float: right; | ||
margin-top: -2rem; | ||
font-size: 0.5rem;">after initial setup</small> | ||
|
||
<hr> | ||
|
||
## Setup | ||
|
||
There are two areas of configuration needed: buildtime, and runtime. | ||
|
||
### Build: Embroider + Webpack | ||
|
||
import `kolay/webpack` | ||
|
||
```js | ||
const { createManifest, apiDocs } = await import("kolay/webpack"); | ||
|
||
return require("@embroider/compat").compatBuild(app, Webpack, { | ||
/* ... */ | ||
packagerOptions: { | ||
webpackConfig: { | ||
devtool: "source-map", | ||
plugins: [createManifest({ src: "public/docs" }), apiDocs({ package: "kolay" })], | ||
}, | ||
}, | ||
}); | ||
``` | ||
|
||
You can create docs for multiple libraries by invoking these plugins more than once: | ||
|
||
```js | ||
devtool: 'source-map', | ||
plugins: [ | ||
createManifest({ src: 'public/docs', name: 'own-manifest.json' }), | ||
apiDocs({ package: 'kolay' }), | ||
createManifest({ src: '../../my-library', name: 'my-library-manifest.json' }), | ||
apiDocs({ package: 'my-library' }), | ||
], | ||
``` | ||
|
||
See related for | ||
|
||
- [createManifest(...)](/plugins/create-manifest.md) | ||
- [apiDocs(...)](/plugins/api-docs.md) | ||
- [All Build Plugins](/plugins/index.md) | ||
|
||
### Runtime: Routing | ||
|
||
If using `@ember/routing/router` or `@embroider/router` | ||
|
||
You'll want to also install `ember-primitives`, so that you can use the [`@properLinks`] decorator on the router, giveng you the ability to _just use anchor tags (`<a>`)_ (a requirement for in-browser linking in markdown). | ||
|
||
```js | ||
import { kolayRoutes } from "kolay"; | ||
import { properLinks } from "ember-primitives/proper-links"; | ||
|
||
@properLinks | ||
export default class Router extends EmberRouter { | ||
location = config.locationType; | ||
rootURL = config.rootURL; | ||
} | ||
|
||
Router.map(function () { | ||
kolayRoutes(this); | ||
}); | ||
``` | ||
|
||
In the spirit of dynamically compiled and discovered docs, this adds a `*wildcard` route that matches all paths and then tries to derive which file to load from there. |
Oops, something went wrong.