You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Repo Assist] Add --embed-resources to fsdocs convert — self-contained HTML output by default (#1072)
* Add --embed-resources to fsdocs convert (default on)
Closes#1068
- Add ConvertHelpers module with findContentSearchDirs and embedResourcesInHtml helpers
- fsdocs convert now inlines local CSS, JS, and images into the output HTML by
default, producing a single self-contained file
- Add --no-embed-resources flag to opt out of embedding
- Add --template fsdocs sentinel to use the built-in default template from
embedded assembly resources without needing a local _template.html
- Automatically set {{root}}="" substitution when embedding so template
paths like {{root}}content/fsdocs-default.css resolve correctly
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci: trigger checks
* Address review comments: lift compiled Regex patterns, use immutable rebinding, add unit tests
- Move cssPattern/jsPattern/imgPattern to module level with RegexOptions.Compiled
- Replace 'let mutable html' + 'html <-' with sequential immutable 'let html =' rebindings
- Add 4 integration unit tests for ConvertHelpers.embedResourcesInHtml:
CSS inlining, JS inlining, remote URLs left unchanged, --no-embed-resources flag
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci: trigger checks
* Fix fsdocs convert substitutions; add tests/manual/convert examples
- Supply default values for all standard {{fsdocs-*}} template parameters
when a template is used with fsdocs convert, so placeholders are replaced
rather than appearing as literal text in the output.
- fsdocs-page-title and fsdocs-collection-name default to the input filename.
- User-supplied --parameters values always override these defaults.
- Add tests/manual/convert/ with README, example.md, example.fsx,
and _template-minimal.html to support manual validation.
- Update RELEASE_NOTES.md.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci: trigger checks
* tests: add image-inlining examples to tests/manual/convert/
- Add tests/manual/convert/images/sample.png (small raster PNG)
- Add tests/manual/convert/images/sample.svg (simple SVG badge)
- Reference both images in example.md so they appear in converted output
- Add Scenario 8 (image inlining enabled) and Scenario 9 (disabled) to README
- Extend Scenario 2 checklist with image data-URI verification
- Add image-related rows to Common Issues table
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci: trigger checks
* Fix Fantomas formatting in tests/manual/convert/example.fsx
Apply Fantomas formatting: [ 1 .. 5 ] → [ 1..5 ] in range literal.
This was the only lint failure in CI for PR #1072.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci: trigger checks
---------
Co-authored-by: Repo Assist <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Don Syme <dsyme@users.noreply.github.com>
Co-authored-by: Don Syme <dsyme@github.com>
Copy file name to clipboardExpand all lines: RELEASE_NOTES.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,8 @@
16
16
*`fsdocs convert` now accepts the input file as a positional argument (e.g. `fsdocs convert notebook.ipynb -o notebook.html`). [#1019](https://github.com/fsprojects/FSharp.Formatting/pull/1019)
17
17
*`fsdocs convert` infers the output format from the output file extension when `--outputformat` is not specified (e.g. `-o out.md` implies `--outputformat markdown`). [#1019](https://github.com/fsprojects/FSharp.Formatting/pull/1019)
18
18
*`fsdocs convert` now accepts `-o` as a shorthand for `--output`. [#1019](https://github.com/fsprojects/FSharp.Formatting/pull/1019)
19
+
*`fsdocs convert` now embeds CSS, JS, and local images directly into the HTML output by default, producing a single self-contained file. Use `--no-embed-resources` to disable. Pass `--template fsdocs` to use the built-in default template without needing a local `_template.html`. [#1068](https://github.com/fsprojects/FSharp.Formatting/issues/1068)
20
+
*`fsdocs convert` now supplies sensible defaults for all standard `{{fsdocs-*}}` template substitution parameters (e.g. `{{fsdocs-page-title}}` defaults to the input filename) so templates work cleanly without requiring `--parameters`. [#1072](https://github.com/fsprojects/FSharp.Formatting/pull/1072)
19
21
* Added full XML doc comments (`<summary>`, `<param>`) to `Literate.ParseAndCheckScriptFile` and `Literate.ParseScriptString` to match the documentation style of the other `Literate.Parse*` methods.
"convert a single document (.md, .fsx, .ipynb) to HTML or another output format without building a full documentation site")>]
@@ -2342,7 +2477,8 @@ type ConvertCommand() =
2342
2477
2343
2478
[<Option("template",
2344
2479
Required =false,
2345
-
HelpText ="Path to an HTML (or other format) template file. When omitted, raw content is written.")>]
2480
+
HelpText =
2481
+
"Path to an HTML template file, or 'fsdocs' to use the built-in default template. When omitted, raw content is written.")>]
2346
2482
member valtemplate=""with get, set
2347
2483
2348
2484
[<Option("outputformat",
@@ -2363,6 +2499,13 @@ type ConvertCommand() =
2363
2499
HelpText ="Additional substitution parameters, e.g. --parameters key1 value1 key2 value2")>]
2364
2500
member valparameters= Seq.empty<string>with get, set
2365
2501
2502
+
[<Option("no-embed-resources",
2503
+
Default =false,
2504
+
Required =false,
2505
+
HelpText =
2506
+
"Disable automatic inlining of local CSS, JS, and images into the output HTML. By default, when a template is used for HTML output, all locally-referenced assets are embedded so the output is a self-contained single file.")>]
2507
+
member valnoEmbedResources=falsewith get, set
2508
+
2366
2509
memberthis.Execute()=
2367
2510
letinputFile= Path.GetFullPath(this.input)
2368
2511
@@ -2402,11 +2545,28 @@ type ConvertCommand() =
2402
2545
else
2403
2546
this.output
2404
2547
2405
-
lettemplateOpt=
2548
+
// Handle --template fsdocs: extract the embedded default template to a temp file.
2549
+
// Handle --template <path>: use as-is.
2550
+
// Handle no template: raw content only (no resource embedding needed).
0 commit comments