Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End-User Documentation New Structure (WIP) #2336

Merged
merged 16 commits into from
Jul 15, 2022

Conversation

alanlomeli
Copy link
Member

  • New _template file to define fantoma's custom theme
  • 2 new style files: global-config for reusing common variables and fsdocs-custom for adding styles to custom theme
  • Fix favicon and sidebar icon not displating
    Added proposal for a couple of documentation sections: index.md, Configuration.md, FormattingCheck.md, GettingStarted.md, GitHooks.md, IgnoreFile.md, StyleGuide.md

Please do let me know if any comments !

Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Alan, you are on the right track here 😊!
Please don't commit any .css file that we generate in F#.
/docs/content/fsdocs-custom.css shouldn't be there.

We will need a couple of more rounds here before we can take this in.
That is why a draft PR can be insightful we proposing big changes.
You don't want to put too much effort into these things when the expected result isn't crystal clear.

Keep it up!

html, body
@import "./global-config.sass"

html, bod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

html, body

<link type="text/css" rel="stylesheet" href="{{root}}content/fsdocs-{{fsdocs-theme}}.css" />
<link type="text/css" rel="stylesheet" href="{{root}}content/fsdocs-custom.css" />
<script type="text/javascript" src="{{root}}content/fsdocs-tips.js"></script>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this shim, IE is finally dead.

@@ -0,0 +1,10 @@
---
category: Documentation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use category End-user documentation instead.

Fantomas follows two F# style guides: the [F# code formatting guidelines](https://docs.microsoft.com/en-us/dotnet/fsharp/style-guide/formatting) from Microsoft by default and the [G-Research F# code formatting guidelines](https://github.com/G-Research/fsharp-formatting-conventions) via various [settings](https://github.com/G-Research/fsharp-formatting-conventions/blob/master/.editorconfig).

## Use cases
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this section, it most likely isn't up to date anymore and doesn't tell that much.

For more complex examples, please take a look at F# outputs of [20 language shootout programs](tests/languageshootout_output) and [10 CodeReview.SE source files](tests/stackexchange_output).

## Why the name "Fantomas"?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move that one to the FAQ page. Is surely isn't necessary to answer on the first page.


The recommended way to use Fantomas is by using the [Ionide plugin](http://ionide.io/). Fantomas is integrated in [FSAutoComplete](https://github.com/fsharp/FsAutoComplete/) which is the language server used by Ionide.

Alternatively, you can install the [fantomas-fmt](https://marketplace.visualstudio.com/items?itemName=paolodellepiane.fantomas-fmt) extension.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the line about fantomas-fmt, this is no longer recommended.

> dotnet new tool-manifest

Install the command line tool with:
> dotnet tool install fantomas
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some more styling to the blockquote, they don't really stand out right now.

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="author" content="{{fsdocs-authors}}">

<link rel="stylesheet" id="theme_link" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/4.6.0/materia/bootstrap.min.css">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses a lot of old bootstrap (probably how the default template works).
Throw this stuff out, we want to own the styling completely.


<link rel="shortcut icon" type="image/x-icon" href="{{root}}img/favicon.ico">
<link type="text/css" rel="stylesheet" href="{{root}}content/navbar-{{fsdocs-navbar-position}}.css" />
<link type="text/css" rel="stylesheet" href="{{root}}content/fsdocs-{{fsdocs-theme}}.css" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are still using the default theme by using this.
Remove <link type="text/css" rel="stylesheet" href="{{root}}content/fsdocs-{{fsdocs-theme}}.css" /> and rely on your own styling.

<!DOCTYPE html>
<html lang="en">

<head>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the right font isn't displaying.
You will need to add

    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Reem+Kufi:wght@400;500;700&display=swap" rel="stylesheet">

at some point I believe.

@nojaf nojaf mentioned this pull request Jul 7, 2022
#fsdocs-content

h1 a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe write this in one selector instead of repeating yourself.
Something like:

h1, h2, h3, h4, h5, h6
  a
    color: $black

sassCompiler.CompileFile(inputFileTemplate, ?outputPath = Some outputTemplate)

let globalConfig =
sassCompiler.CompileFile(inputGlobalConfig, ?outputPath = Some outputGlobalConfig)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the globalConfig should be compiled since it is only imported by the other files.

@nojaf
Copy link
Contributor

nojaf commented Jul 14, 2022

Making another note here, I think we currently have two limitations with using FsDoc.

For the first problem, I'd propose a two-folded workaround:

  • While developing, we add some JavaScript that transforms the existing HTML to what we need.
  • After the build, when all HTML files are generated, we do some post-processing to update the HTML to what we need.

This will be fixing the same thing twice but all in all, it won't be that much effort to do this.

The second problem is a lick more difficult. We will need to generate the API documentation outside of the fsdocs command line tool. This can be done using another F# script.

#r "nuget: FSharp.Formatting, 15.0.1" // Grabs a NuGet package from the NuGet Gallery.

open FSharp.Formatting.ApiDocs
open System.IO

let model =
    ApiDocs.GenerateModel(
        // These are the project dll outputs that will be used to generate the API docs.
        [ ApiDocInput.FromFile(@"C:\Users\nojaf\Projects\fantomas\src\Fantomas.FCS\bin\Debug\netstandard2.0\Fantomas.FCS.dll") 
          ApiDocInput.FromFile(@"C:\Users\nojaf\Projects\fantomas\src\Fantomas.Core\bin\Debug\netstandard2.0\Fantomas.Core.dll") ],
        collectionName = "Fantomas.Core",
        substitutions = []
    )

#r "nuget: Fable.React"

open Fable.React

// TODO: transform the model into html
// Mapping each model/namespace to its own page.

let content = div [] [
    str "hey some content"
]

open Fable.ReactServer

renderToString(content)

Using something like Fable.React (to have some sort of HTML like DSL) we can construct the HTML for the {{fsdocs-content}} placeholder.
To re-use the existing _template.html, we can write out the generated HTML as Markdown file (.md).
The HTML content will be replaced inserted in the template.

We can discuss this further during a call @yisusalanpng.

@nojaf nojaf marked this pull request as ready for review July 15, 2022 13:53
Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good initial progress @yisusalanpng!
Keep it up!

@@ -0,0 +1,8198 @@
@charset "UTF-8";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this generated? If so don't commit it.

alanlomeli and others added 16 commits July 15, 2022 16:10
- Add new FAQ section
- Changed contributors list
- Cleanup template unused statements
- Change section name from Documentation to End-user documentation
- Add new FAQ section
- Change contributors list
- Cleanup template unused statements
- Change section name from Documentation to End-user documentation
- Delete styleguide to build a new one
- Getting Started section divided in multiple pages
- Remove fantomas-fmt from recommended
- Remove default stylings
- Create new benchmarks page
- Add basic styling for main theme (WIP)
- Tweak fsdocs-custom.sass to add common selector for headers
- Temporal script to modify fs-docs default stylings
- Add coloring styling for F# code
- Add logo and searchbar for namespaces
@nojaf nojaf merged commit 87cd212 into fsprojects:master Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants