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

proposal: new docs customization options #582

Closed
wants to merge 7 commits into from

Conversation

abvthecity
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Mar 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
fern-dev ❌ Failed (Inspect) Mar 28, 2024 2:30pm
3 Ignored Deployments
Name Status Preview Updated (UTC)
fern-prod ⬜️ Ignored (Inspect) Mar 28, 2024 2:30pm
fontawesome-cdn ⬜️ Ignored (Inspect) Visit Preview Mar 28, 2024 2:30pm
private-docs ⬜️ Ignored (Inspect) Mar 28, 2024 2:30pm

Copy link

Copy link

PR Preview

Building...

@@ -0,0 +1,90 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json
Copy link
Contributor Author

@abvthecity abvthecity Mar 27, 2024

Choose a reason for hiding this comment

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

All of the types that are shared between read and write are centralized in common .yml files. This makes it a lot easier to understand the impact a change has between read and write, and compare why they are different in some small cases.

ThemeConfigRead:
extends: ThemeConfigShared
properties:
background: BackgroundSolidOrGradient
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For example, this transformation should never have happened!

accentPrimary: optional<ColorConfig>
background: optional<ColorConfig>

ColorsConfigV3:
Copy link
Contributor Author

@abvthecity abvthecity Mar 27, 2024

Choose a reason for hiding this comment

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

We'll need to introduce a v4 of this config where:

ColorsConfigV4:
  properties:
    dark: optional<ThemeConfigRead>
    light: optional<ThemeConfigRead>

Alternatively, we can just make all of the properties dark or light:

ColorsConfigV4:
  properties:
    logo: optional<commons.ThemedFileId>
    accentPrimary: optional<ThemedRgbaColor>
    backgroundColor: optional<ThemedBackgroundColor>
    # ...

I haven't decided which one is easier to implement from; so we'll leave this decision to a future PR.

fernButton: ./fern-button.yml

types:
HeaderLinksConfig:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of navbarLinks: optional<list<NavbarLinks>>, we'll

  1. call this "header links" because they are links rendered in the header
  2. leave this as an object to allow for future configuration options
  3. use the FernLinkButtonConfig for full button customizability.

custom: CustomFontConfig
google: GoogleFontConfig

GoogleFontConfig:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

GoogleFontConfig is new here. This is how we'd implement it: vercel/next.js#40345

id: optional<rootCommons.DocsConfigId>
config: DocsConfig
search: SearchInfo

# deprecated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we should eventually remove this from read.

- HeaderPositionDeprecated

SidebarOrHeaderPlacementDeprecated:
enum:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the best way to express that we want to rename HEADER to header because the conversions is confusing.

the following two methods did not work:

SidebarOrHeaderPlacementWrite:
  extends: SidebarOrHeaderPlacement
  enum:
    - HEADER
    - SIDEBAR

because extends is not supported in enums

SidebarOrHeaderPlacementWrite:
  enum:
    - header
    - sidebar
    - HEADER
    - SIDEBAR

because sidebar and SIDEBAR collide in generated types. (this was caught in fern generate, and not in fern check)

Also, I would have expected this to work, but it doesn't:

- type: VERSION
  availability: deprecated

# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

types:
FernLinkButtonConfig:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is how expressive our config should be when it comes to UI elements.

Eventually we want to be able to construct a layout-rich page using YML

layout:
  theme: homepage
  heading: test.yml
  image: assets/image.png
  sections:
    - markdown: |
        ### inline markdown content
    - markdown: sections/markdown-file.yml
    - buttons:
         - buttonA
         - text: An inline button
           icon: puzzle

components:
  buttonA:
    text: My button
    icon: home
    href: https://google.com

@abvthecity abvthecity changed the title chore: refactor docs customization options proposal: refactor docs customization options Mar 27, 2024
@abvthecity abvthecity changed the title proposal: refactor docs customization options proposal: new docs customization options Mar 27, 2024
Copy link

PR Preview

Building...

Copy link

@dsinghvi dsinghvi closed this May 20, 2024
@abvthecity abvthecity deleted the ajiang/refactor-fdr-customization branch June 4, 2024 01:33
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