New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-cayman

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cayman

The popular Cayman theme as a React component

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-cayman

npm version downloads issues licence

The popular cayman theme implemented as a React component!

installation

with npm npm react-cayman.
or yarn add react-cayman.

Usage

With markdown file

This component support markdown out of the box using markdown-it. In this example the testReadme.md file is loaded and rendered on the screen. In this case CaymanPage is expected to have a single child which is the loaded markdown as text(string!).

import React, {useEffect, useState} from 'react';
import CaymanPage from 'react-cayman';
import readmePath from './testReadme.md';

function App() {
    const [text, setText] = useState('');

    useEffect(() => {
        fetch(readmePath)
            .then((response) => {
                return response.text();
            })
            .then((text) => {
                setText(text);
            });
    }, []);

    return (
        <div className="App">
            <CaymanPage
                repoName={'your repo name - main header'}
                repoUrl="https://github.com/<username>/<repo-name>"
                repoDescription={'one line description'}
                repoOwner="https://github.com/<username>">
                {text}
            </CaymanPage>
        </div>
    );
}

export default App;

With custom html

in case you want to use your own markdown or in case you don't want the content page to be markdown use this component like this:

import React, {useEffect, useState} from 'react';
import CaymanPage from 'react-cayman';
import readmePath from './testReadme.md';

function App() {
    return (
        <div className="App">
            <CaymanPage
                repoName={'your repo name - main header'}
                repoUrl="https://github.com/<username>/<repo-name>"
                repoDescription={'one line description'}
                repoOwner="https://github.com/<username>"
                markdown={false} //notice !
            >
                <div>
                    hello world!
                </div>
                <p>Your custom html here</p>
            </CaymanPage>
        </div>
    );
}

export default App;

Demos

this demo (at this repo at ./example) will create cayman page for this repo. note that this is a React component. code sandbox: https://codesandbox.io/s/github/Eliav2/react-cayman/tree/main/example

Why

Cayman theme for GitHub Pages is implemented with Jekyll which uses Liquid and other dependencies which relies on Ruby on rails and not Node. this component is refactored, so you could simply 'react import' it, and it uses the original cayman theme styles.

Props

  • repoName[string] - the main header.
  • repoDescription[string] - description under the main header.
  • repoUrl[string] - url to the button under the header.
  • repoOwner[string] - url for owner used in the footer.
  • markdown[boolean] - markdown mode or plain html mode?
  • showHeader[boolean] - show the header?
  • showFooter[boolean] - show the footer?

if any other usage is needed fork this repo and edit it for your needs.

differences from the original

  • The Markdown processor of this component is markdown-it instead of kramdown, which for my option is much better.
  • The highlighter of the Markdown processor is highlight.js instead of Rouge

Versions

See CHANGELOG.md in this repo.

Keywords

FAQs

Package last updated on 10 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc