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

Docs conversion #626

Open
Freymaurer opened this issue Oct 21, 2024 · 0 comments
Open

Docs conversion #626

Freymaurer opened this issue Oct 21, 2024 · 0 comments

Comments

@Freymaurer
Copy link

Freymaurer commented Oct 21, 2024

Hey! I use Feliz since for a lot of projects and wanted to contribute to the documentation, but nothing was working for me 😅

I checked the documentation project and saw that it was very complex with ~1400 lines of code for routing alone.

Combined with a comment i found, i came here with a suggestion.

Hi there @Darkle, apologies for the delay. I've merged your PR but the docs application is broken and needs an update. Probably an overhaul along with the changes to the CI. I will be fixing it as soon as time permits 🙏

Originally posted by @Zaid-Ajaj in #618 (comment)

Goal

My goal was using a well developed documentation framework, while displaying f# code and the resulting react components.

Tip

Check out the PR #627 if you want to see it in action.

go to public and run npm run dev 🚀

Implementation

I forked this repo and set up a astro starlight documentation in the public folder.

Note

Astro can render any frontend framework components (react, svelte, vue,...)

  1. Create a f# project in public/src/components/fsharp.
  2. Update npm run dev to include fable transpilation dotnet fable watch src/components/fsharp -e jsx --run astro dev
  3. Add dependency to Feliz nuget package (the Feliz.fsproj did not work for me. There were transpilation errors vor Feliz.CompilerPlugins and i wanted to get some feedback before investigating any deeper issues)
  4. Create POC react components in f# in public/src/components/fsharp
  5. Add Feliz core documentation to public/src/docs/Feliz
  6. Showcase code and component import for example in public/src/docs/Feliz/ReactApiSupport.mdx
import rawCounter from '/src/components/fsharp/Counter.fs?raw';
import {Counter} from '/src/components/fsharp/Counter.jsx';

<Code code={rawCounter} lang='fsharp'/>
<Counter client:only="react"/>

image

Advantages

  • it just works™️ ; Astro works well and is highly customizable. Far less code to maintain. No routing logic, etc.
  • Display actual code used for component next to the component. Feature changes/obsolete stuff gets caught easily.

Disadvantages

  • No full f#?

Conclusion

The current documentation setup is very complicated and can create a entry barrier for new contributers. My suggestion offers an easy alternative to a full f# documentation project, reusing existing features from astro while focusing on f# components.

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

No branches or pull requests

1 participant