Skip to content

Support for rendering both re and ml syntaxes, within the same generation #1342

@davesnx

Description

@davesnx

Looking at the PR where Reason got added, #156, there seems to be a tension between generating "only ml" and "only re," and the tendency has become to accept a separate file generation for each syntax. While the initial idea was to generate both side by side: #129 (comment)

The current state is good if you want to keep separate documentation sites, but it's very bad if you want to treat users with both syntax preferences in one documentation.

This issue proposes generating both code snippets side by side and expecting the browser to hide/show them based on a UI toggle via CSS or a simple JavaScript call. As it's working here with ReScript / Reason syntaxes https://styled-ppx.vercel.app. Video here: https://x.com/davesnx/status/1862086636898824248/video/1

I think this might be very helpful in conjunction with #1341, where the site-generator tool has built the convention of rendering code snippets side by side. It has been standardized by shiki, one of the most common syntax highlighters in the JavaScript ecosystem.

This issue would be implemented in both HTML output and markdown output.

I propose a new constructor because it made sense to me, but I'm happy to have another design like --generate-all-langs-together or similar, up to discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions