Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit 62d0450

Browse files
feat: add macros plugin (#703)
* feat: add macros plugin * feat: switch to mkdocs-git-revision-date-localized-plugin for compatibility with macros plugin * update insiders yaml * add macros plugin to insiders * fix: white space in insiders.mkdocs.yml * chore: add macros to eslint ignore (same as includes) * chore: fix typos in macros --------- Co-authored-by: Brian Giori <[email protected]>
1 parent 9a874e0 commit 62d0450

7 files changed

+46
-8
lines changed

.markdownlintignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/includes
2+
/macros
23
LICENSE.md
34
/vale
4-
/.github
5+
/.github

cspellignore.txt

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ DSAR
9595
EBRs
9696
Eckert
9797
elif
98+
endmacro
9899
encid
99100
Enterpret
100101
enterpret

insiders.mkdocs.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ extra_css:
66
plugins:
77
- search
88
- tags #insiders
9-
- git-revision-date
9+
- git-revision-date-localized
10+
- macros:
11+
include_dir: macros
12+
j2_block_start_string: '@{%'
13+
j2_block_end_string: '%}'
14+
j2_variable_start_string: '@{{'
15+
j2_variable_end_string: '}}'
1016
- glightbox # enables image light box
1117
- social: #insiders
1218
cards_color:
@@ -59,7 +65,7 @@ markdown_extensions:
5965
class: mermaid
6066
format: !!python/name:pymdownx.superfences.fence_code_format
6167
- pymdownx.tabbed: # Enables content tabs
62-
alternate_style: true
68+
alternate_style: true
6369
slugify: !!python/object/apply:pymdownx.slugs.slugify
6470
kwds:
6571
case: lower
@@ -69,8 +75,8 @@ markdown_extensions:
6975

7076

7177

72-
# Long explanation for this extra doc.
78+
# Long explanation for this extra doc.
7379
# In order to use config inheritance, everything must use the alternative syntax (key:value vs lists)
74-
# Lists are replaced wholesale with config inheritence.
80+
# Lists are replaced wholesale with config inheritence.
7581
# I couldn't get alternative syntax to work on mkdocs.yml without throwing constant errors and strange behavior.
76-
# For now, mkdocs.yml plugins need to be all NON-insiders plugins, and insiders.mkdocs.yml is ALL plugins.
82+
# For now, mkdocs.yml plugins need to be all NON-insiders plugins, and insiders.mkdocs.yml is ALL plugins.

macros/macros.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@{% macro input(name, value='', type='text', size=20) -%}
2+
<input type="@{{ type }}" name="@{{ name }}" value="@{{
3+
value|e }}" size="@{{ size }}">
4+
@{%- endmacro %}

macros/sdk-configuration-ts.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@{% macro sdk_configuration_ts(flushIntervalSeconds=1, flushQueueSize=30, flushMaxRetries=5) -%}
2+
???config "Configuration Options"
3+
| <div class="big-column">Name</div> | Description | Default Value |
4+
| --- | --- | --- |
5+
|`apiKey`| Required. `string`. The apiKey of your project. | `null` |
6+
|`flushIntervalMillis`| `number`. The amount of time waiting to upload the event to the server in milliseconds. | @{{flushIntervalSeconds}} second@{% if flushIntervalSeconds > 1 %}s@{% endif %}.|
7+
|`flushQueueSize`| `number`. The maximum number of events that can be stored locally before forcing an upload. | @{{flushQueueSize}} events. |
8+
|`flushMaxRetries`| `number`. The max retry limits. | @{{flushMaxRetries}} times.|
9+
|`logLevel`| `LogLevel.None` or `LogLevel.Error` or `LogLevel.Warn` or `LogLevel.Verbose` or `LogLevel.Debug`. The log level. | `LogLevel.Warn` |
10+
|`loggerProvider`| `Logger`. Implements a custom `loggerProvider` class from the Logger, and pass it in the configuration during the initialization to help with collecting any error messages from the SDK in a production environment.| `Amplitude Logger` |
11+
|`minIdLength`| `number`. Overrides the minimum length of `user_id` & `device_id` fields. | `5` |
12+
|`optOut`| `boolean`. If `optOut` is `true`, the event isn't sent to Amplitude's servers. | `false` |
13+
|`serverUrl`| `string`. The server url events upload to. | `https://api2.amplitude.com/2/httpapi` |
14+
|`serverZone`| `EU` or `US`. Set Amplitude Server Zone, switch to zone related configuration. To send data to Amplitude's EU servers should configure to `EU` | `US` |
15+
|`storageProvider`| `Storage<Event[]>`. Implements a custom `storageProvider` class from Storage. | `MemoryStorage` |
16+
|`useBatch`| `boolean`. When `true`, uses the Batch API instead of the HTTP V2 API.| `false` |
17+
|`transportProvider`| `Transport`. Custom HTTP client. For example, sending requests to your proxy server with customized HTTP request headers.| `Transport` |
18+
|`transport`| `TransportType.XHR` or `TransportType.SendBeacon` or `TransportType.Fetch`. Set the transport type. | `TransportType.Fetch` |
19+
@{%- endmacro %}

mkdocs.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ extra_javascript:
6767
# When you add a plugin here, make sure the change is updated in insiders.mkdocs.yml and insiders.local.build.yml too.
6868
plugins:
6969
- search # the search plugin
70-
- git-revision-date # enables the git revision date functionality
70+
- git-revision-date-localized # enables the git revision date functionality, compatible with macros plugin
71+
- macros:
72+
include_dir: macros
73+
j2_block_start_string: '@{%'
74+
j2_block_end_string: '%}'
75+
j2_variable_start_string: '@{{'
76+
j2_variable_end_string: '}}'
7177

7278
# Extensions
7379
# When you add or change an extension here, mirror changes in insiders.mkdocs.yml.

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ mkdocs-glightbox==0.2.1
1818
pygments-graphql-lexer==0.1.0
1919

2020
# Requirements for plugins
21-
mkdocs-git-revision-date-plugin==0.3.1
21+
mkdocs-git-revision-date-localized-plugin==1.2.0
22+
mkdocs-macros-plugin==0.7.0
2223
babel>=2.10.3
2324
lxml>=4.6
2425
paginate>=0.5.6

0 commit comments

Comments
 (0)