Merge pull request #31838 from karthikjeeyar/mkdocs-patch
feat(techdocs): add app-config option to disable external font download
This commit is contained in:
@@ -149,6 +149,8 @@ Options:
|
||||
Defaults to false, which means that the techdocs-core plugin is always added to the mkdocs file.
|
||||
--legacyCopyReadmeMdToIndexMd Attempt to ensure an index.md exists falling back to using <docs-dir>/README.md or README.md
|
||||
in case a default <docs-dir>/index.md is not provided. (default: false)
|
||||
--disableExternalFonts Disable external font downloads for all TechDocs sites. Useful for air-gapped environments
|
||||
where Google fonts cannot be accessed. (default: false)
|
||||
--runAsDefaultUser Bypass setting the container user as the same user and group id as host for Linux and MacOS (default: false)
|
||||
-v, --verbose Enable verbose output. (default: false)
|
||||
-h, --help display help for command
|
||||
|
||||
@@ -97,6 +97,33 @@ techdocs:
|
||||
legacyCopyReadmeMdToIndexMd: false
|
||||
```
|
||||
|
||||
#### Disable external fonts
|
||||
|
||||
`techdocs.generator.mkdocs.disableExternalFonts`
|
||||
|
||||
(Optional) Use this when the generator cannot reach the internet (for example air-gapped or restricted networks). MkDocs Material otherwise tries to download the Roboto font from Google during generation.
|
||||
|
||||
When `true`, TechDocs patches each `mkdocs.yml` during generation: if no `theme` section exists it adds `name: material` and `font: false`; if a `theme` exists but `font` is omitted, it sets `font: false`; if `font` is already set in the file, your value is left unchanged.
|
||||
|
||||
**Example:**
|
||||
|
||||
```yaml
|
||||
techdocs:
|
||||
generator:
|
||||
mkdocs:
|
||||
disableExternalFonts: true
|
||||
```
|
||||
|
||||
Alternatively, configure `mkdocs.yml` manually:
|
||||
|
||||
```yaml
|
||||
theme:
|
||||
name: material
|
||||
font: false
|
||||
```
|
||||
|
||||
**Note:** When using `theme.font` in `mkdocs.yml`, `theme.name: material` is required. If `font` is already set in the file, app-config patching does not override it; it only adds `font: false` when `font` was not configured.
|
||||
|
||||
#### Default Plugins
|
||||
|
||||
`techdocs.generator.mkdocs.defaultPlugins`
|
||||
|
||||
@@ -373,9 +373,24 @@ on how you have configured your `template.yaml`.
|
||||
|
||||
Done! You now have support for TechDocs in your own software template!
|
||||
|
||||
### Prevent download of Google fonts
|
||||
### Disable external fonts
|
||||
|
||||
If your Backstage instance does not have internet access, the generation will fail. TechDocs tries to download the Roboto font from Google. You can disable it by adding the following lines to mkdocs.yaml:
|
||||
`techdocs.generator.mkdocs.disableExternalFonts`
|
||||
|
||||
(Optional) Use this when the generator cannot reach the internet (for example air-gapped or restricted networks). MkDocs Material otherwise tries to download the Roboto font from Google during generation.
|
||||
|
||||
When `true`, TechDocs patches each `mkdocs.yml` during generation: if no `theme` section exists it adds `name: material` and `font: false`; if a `theme` exists but `font` is omitted, it sets `font: false`; if `font` is already set in the file, your value is left unchanged.
|
||||
|
||||
**Example:**
|
||||
|
||||
```yaml
|
||||
techdocs:
|
||||
generator:
|
||||
mkdocs:
|
||||
disableExternalFonts: true
|
||||
```
|
||||
|
||||
Alternatively, configure `mkdocs.yml` manually:
|
||||
|
||||
```yaml
|
||||
theme:
|
||||
@@ -383,11 +398,19 @@ theme:
|
||||
font: false
|
||||
```
|
||||
|
||||
:::note Note
|
||||
**Note:** When using `theme.font` in `mkdocs.yml`, `theme.name: material` is required. If `font` is already set in the file, app-config patching does not override it; it only adds `font: false` when `font` was not configured.
|
||||
|
||||
The addition `name: material` is necessary. Otherwise it will not work
|
||||
#### Using techdocs-cli in CI/CD
|
||||
|
||||
:::
|
||||
When generating TechDocs sites in CI/CD workflows using `techdocs-cli`, you can
|
||||
use the `--disableExternalFonts` flag:
|
||||
|
||||
```bash
|
||||
techdocs-cli generate --disableExternalFonts
|
||||
```
|
||||
|
||||
This will automatically patch the `mkdocs.yml` file during the generation
|
||||
process, just like the `app-config.yaml` option does for local generation.
|
||||
|
||||
## How to enable iframes in TechDocs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user