Skip to content

allow embedding resources in fsdocs convert html files #1068

@nhirschey

Description

@nhirschey

This is related to #1019, but I'm putting it in a separate issue to not hold that PR up.

With the proposed fsdocs convert function there's no easy way to pass my existing _template.html file (or the default fsdocs template) to the new fsdocs convert command without errors because the template relies on external css/js content. It would be nice to have functionality similar to pandocs --embed-resources command, so we could easily get the output on the right rather than the output on the left.

Proposal for commands:

// no external dependencies using the default FSharp.Formatting _template.html file as the basis
// this is useful if you want to use the fsdocs tool outside the "docs" structure where you might not have
// a _template.html file. Or if you are using the default tempate, 
// you do not have a _template.html file in your docs folder
fsdocs convert file.fsx --output file.html --template fsdocs --embed-resources

// no external dependencies using the site's customized _template.html file as the basis
fsdocs convert file.fsx --output file.html --template _template.html --embed-resources

The idea for these embed-resources output is that the output html should embed all the template's CSS and JS inline
and produce a single HTML file that renders correctly without companion files.

Key Changes from the Default Template

  • Inline all CSS/JS from the content/ directory into <style> and <script> tags instead of /<script src> references
  • Remove features irrelevant to single-file output: search, sidebar navigation, page menu
  • Remove unsubstituted {{}} template variables that are not substituted by fsdocs convert.
  • Keep: theme toggle, syntax highlighting, tooltips, copy buttons, responsive layout

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions