mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
2c0b48370b
* feat(gen-docs): add documentation generation package with SassDoc and TypeDoc support Add new `@hugo-fixit/gen-docs` package that parses Hugo config (hugo.toml) and generates documentation. Includes SassDoc annotations for SCSS variables and mixins, TypeDoc config for TypeScript source docs, and a `.sassdocrc` configuration file. * docs(readme): add browsers support section * feat(gen-docs): add Hugo partials docs generation and fix config empty sections - Add partial-parser.ts: parses Hugo partial comment blocks (@param/@return/@example) - Add partials.ts renderer: generates grouped Markdown with param tables - Add `partials` subcommand with -t/-o options for template injection - Fix config-parser: empty TOML sections (library.js/library.css) now retain descriptions - Fix config-parser: correctly distinguish section-level vs key-level comments - Update README with partials subcommand documentation
37 lines
1.3 KiB
HTML
37 lines
1.3 KiB
HTML
{{- /*
|
|
Icon renderer for Font Awesome classes and SVG sources.
|
|
- Renders `<i>` element when `.Class` is provided.
|
|
- Resolves local SVG resources or external SVG URL fallback.
|
|
- Supports Simple Icons shorthand by icon name.
|
|
@param {String} [.Class] - Icon class name for `<i>`
|
|
@param {String} [.Src] - SVG source path or URL
|
|
@param {String} [.Simpleicons] - Simple-icons icon name
|
|
@param {String} [.Prefix] - Custom prefix for simple-icons source path
|
|
*/ -}}
|
|
|
|
{{- with .Class -}}
|
|
<i class="{{ . }}" aria-hidden="true"></i>
|
|
{{- else -}}
|
|
{{- $src := .Src -}}
|
|
{{- with .Simpleicons -}}
|
|
{{- $prefix := $.Prefix | default "lib/simple-icons/icons" | strings.TrimSuffix "/" -}}
|
|
{{- $src = printf "%v/%v.svg" $prefix . -}}
|
|
{{- end -}}
|
|
|
|
{{- if not $src -}}
|
|
{{- errorf "Icon src is missing: %s" templates.Current.Filename -}}
|
|
{{- end -}}
|
|
|
|
{{- if (urls.Parse $src).Host | not -}}
|
|
{{- with resources.Get $src -}}
|
|
{{- $resource := . | resources.Minify -}}
|
|
{{- $resource.Content | replaceRE `<svg ` `<svg class="icon" ` | safeHTML -}}
|
|
{{- else -}}
|
|
{{- errorf "Icon does not exist %v" $src -}}
|
|
{{- end -}}
|
|
{{- else -}}
|
|
{{- /* fetch svg icon from external source */ -}}
|
|
<i data-svg-src="{{ $src }}" aria-hidden="true"></i>
|
|
{{- end -}}
|
|
{{- end -}}
|