Skip to content

Commit

Permalink
chore: fix docs build (#6635)
Browse files Browse the repository at this point in the history
* chore: fix docs build

* chore: update remark version and revert remark-html version

Related angular/angular#24000

* chore: remove rehype

* chore: fix docs app console errors
  • Loading branch information
jakovljevic-mladen committed Dec 27, 2021
1 parent 218c924 commit 5835116
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 178 deletions.
253 changes: 100 additions & 153 deletions docs_app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions docs_app/package.json
Expand Up @@ -118,9 +118,8 @@
"lunr": "^2.1.0",
"mkdirp": "^0.5.1",
"protractor": "~7.0.0",
"rehype": "^10.0.0",
"rehype-slug": "^2.0.3",
"remark": "^10.0.1",
"remark": "^12.0.1",
"remark-html": "^13.0.2",
"rimraf": "^2.6.1",
"semver": "^6.1.1",
Expand Down
13 changes: 5 additions & 8 deletions docs_app/src/app/custom-elements/code/pretty-printer.service.ts
Expand Up @@ -5,10 +5,6 @@ import { first, map, share } from 'rxjs/operators';

import { Logger } from 'app/shared/logger.service';

declare const System: {
import(name: string): Promise<any>;
};

type PrettyPrintOne = (code: string, language?: string, linenums?: number | boolean) => string;

/**
Expand All @@ -24,12 +20,13 @@ export class PrettyPrinter {
}

private getPrettyPrintOne(): Promise<PrettyPrintOne> {
const ppo = (window as any)['prettyPrintOne'];
const ppo = (window as any).prettyPrintOne;
return ppo ? Promise.resolve(ppo) :
// prettify.js is not in window global; load it with webpack loader
System.import('assets/js/prettify.js')
// `prettyPrintOne` is not on `window`, which means `prettify.js` has not been loaded yet.
// Import it; as a side-effect it will add `prettyPrintOne` on `window`.
import('assets/js/prettify.js' as any)
.then(
() => (window as any)['prettyPrintOne'],
() => (window as any).prettyPrintOne,
err => {
const msg = `Cannot get prettify.js from server: ${err.message}`;
this.logger.error(new Error(msg));
Expand Down
2 changes: 1 addition & 1 deletion docs_app/tools/transforms/remark-package/index.js
Expand Up @@ -5,5 +5,5 @@ var Package = require('dgeni').Package;
* @description Overrides the renderMarkdown service with an implementation based on remark
*/
module.exports = new Package('remark', ['nunjucks'])

.factory(require('./services/markedNunjucksFilter'))
.factory(require('./services/renderMarkdown'));

0 comments on commit 5835116

Please sign in to comment.