Coder Social home page Coder Social logo

seapagan / react-github-readme-button Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 5.25 MB

A React component to display a Markdown-formatted README file in a modal popup

Home Page: https://seapagan.github.io/react-github-readme-button/

License: MIT License

HTML 0.44% JavaScript 98.05% SCSS 0.57% CSS 0.94%
component markdown reactjs

react-github-readme-button's People

Contributors

dependabot[bot] avatar seapagan avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

eaguaida

react-github-readme-button's Issues

relative links don't work

Relative links, for example, to files in the repository, do not work correctly. They are relative to GitHub root not the relevant project.

filename is case sensitive

GitHub is case-insensitive for READMEs - readme.md and Readme.md` will both work.

While this component allows you to specify the filename, it will not automatically try upper/lower versions.

Crash under newer versions of Vite

The issue seems to be related to the markdownjs library way we import the highlight.js library used internally and a change in Vite. It should work fine in any default CRA project, though.

Error is :

11:03:43.946 ReferenceError: require is not defined
Please report this to https://github.com/markedjs/marked.
    highlight index-bf2e5e5a.js:29758
    code index-bf2e5e5a.js:27241
    parse index-bf2e5e5a.js:27483
    parse index-bf2e5e5a.js:27425
    J index-bf2e5e5a.js:27692
    pP index-bf2e5e5a.js:29812
    uc index-bf2e5e5a.js:5987
    Ws index-bf2e5e5a.js:7234
    fE index-bf2e5e5a.js:7106
    w index-bf2e5e5a.js:626
    ue index-bf2e5e5a.js:660
    r5 index-bf2e5e5a.js:673
    r5 index-bf2e5e5a.js:794
    W8 index-bf2e5e5a.js:1
    <anonymous> index-bf2e5e5a.js:32776
index-bf2e5e5a.js:formatted:4857

The fix is to import the library instead of requiring it later in the code.

Needs 'sass' compiler installed.

End users (during development time) will need a sass compiler installed due to the component using the SCSS language for styles. Without this, the application will error.

There are 2 ways to fix this:

  1. add sass as a dev dependency to this component
  2. compile the SCSS to CSS at build time.
  3. Re-write as CSS, there is really very little of it anyway, and SCSS is only used for nesting

button should be a button!

The button should be a <button> element for semantic reasons.
The CSS should therefore remove all button-specific styles (in a cross-browser fashion) to result in the same base display that can then be built upon by the consumer as required.

Another scrolling issue

if the README is smaller than the popup, so it will not scroll, the mouse wheel is actually passed down to the underlying app. Ideally, in this case, the scrolling should be disabled completely.

Suggestion: Support .rst files etc.

While most GitHub READMEs are markdown, other formats are used (see https://github.com/github/markup/blob/master/README.md#markups).

The other more common one is .rst (reStructuredText)

GitHub markdown processor supports all of these, can we use that instead (but I have only found a version for Ruby not JS) and detect the correct README file (it would require either a GraphQL call to find the actual README or try/catch with a list of extensions)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.