Pitch: Adding Support for custom html elements in DocC
- Author: Nevio Hirani (@n3v1)
- Status: Awaiting review
- Related Issue: Simplyfiying the implementation of custom content (Support for Custom HTML) · Issue #1072 · swiftlang/swift-docc · GitHub
Introduction
This proposal seeks to enhance the Swift DocC compiler by allowing the inclusion of custom HTML files, specifically header.html
and footer.html
, to enrich the customization options available for DocC documentation. The ability to include these custom elements will facilitate a more cohesive and branded documentation experience for developers.
Motivation
The current process for integrating custom headers and footers in DocC documentation is complex and not user-friendly. This complexity can hinder the ability of developers to align their documentation with their project's branding. By enabling users to include their own HTML files, we aim to create a more streamlined and flexible approach that enhances the overall user experience.
Proposed Solution
The DocC compiler will be enhanced to support two methods for including custom HTML files:
-
Automatic Detection: The compiler will automatically identify custom HTML files stored in a specified directory using a wildcard search mechanism. This will allow the detection of files such as
header.html
andfooter.html
without requiring manual adjustments to the build process. -
Custom Scripts Configuration: Additionally, users will have the option to specify custom HTML files in a
custom-scripts.json
configuration file. This file can be structured as follows:{ "htmlElements": { "header": "path/to/header.html", "footer": "path/to/footer.html" } }
This configuration allows users to easily integrate their custom HTML files into the generated documentation, streamlining the process of incorporating headers and footers without changing the way how the DocC Compiler works.
Importance
By streamlining the integration of custom HTML elements, we significantly enhance the usability of DocC documentation. This improvement will empower developers to focus on content creation rather than navigating technical hurdles, leading to a more efficient workflow.
A user-friendly approach to documentation customization will promote professional and consistent guidance, strengthening connections with users and enhancing their overall experience.
Conclusion
Incorporating support for custom HTML files in the Swift DocC compiler represents a valuable enhancement that aligns with the needs of developers. By simplifying the documentation process, we can ensure that users can create engaging and professionally branded documentation that accurately reflects their projects.