Skip to content

Fix Indentation of const script = ... #2254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions internal-docs/custom-themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ Google Analytics. This could be done with the following theme:
```tsx
import { Application, DefaultTheme, PageEvent, JSX } from "typedoc";

const script = `
(function() {
var _owa = document.createElement('script'); _owa.type = 'text/javascript';
_owa.async = true; _owa.src = '${site}' + '/modules/base/js/owa.tracker-combined-min.js';
var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa,
_owa_s);
}());
`.trim();

class MyThemeContext extends DefaultThemeRenderContext {
// Important: If you use `this`, this function MUST be bound! Template functions are free
// to destructure the context object to only grab what they care about.
Expand All @@ -30,15 +39,6 @@ class MyThemeContext extends DefaultThemeRenderContext {

const site = this.options.getValue("gaId");

const script = `
(function() {
var _owa = document.createElement('script'); _owa.type = 'text/javascript';
_owa.async = true; _owa.src = '${site}' + '/modules/base/js/owa.tracker-combined-min.js';
var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa,
_owa_s);
}());
`.trim();

return (
<script>
<JSX.Raw html={script} />
Expand Down