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

Prism.js plugin #25

Open
4 tasks
aileen opened this issue Jan 14, 2019 · 3 comments
Open
4 tasks

Prism.js plugin #25

aileen opened this issue Jan 14, 2019 · 3 comments
Labels
feature New feature or request help wanted Community project needs info

Comments

@aileen
Copy link
Member

aileen commented Jan 14, 2019

Problem description

Prism.js doesn't work "out of the box" for Ghost posts currently. There is a workaround to use Prism.js, which is used in the Ghost Docs repository here:

class Post extends React.Component {
    componentDidMount() {
        Prism.highlightAll()
    }
   ...
}

This solution only supports basic languages, which handlebars, yaml, and json for example are not being considered as.

Proposal

Similar to the gatsby-remark-prismjs plugin, we can create a plugin for Ghost that does the same for Ghost posts.

Maybe there are other solutions for this. This needs to be investigated further.

Todos

  • investigate do-ability further
  • write up tech spec and agree on solution with core team
  • implement solution
  • publish plugin
@aileen aileen added enhancement Improvement/enhancement of existing features help wanted Community project feature New feature or request needs info and removed enhancement Improvement/enhancement of existing features labels Jan 14, 2019
@nehalist
Copy link

nehalist commented Apr 6, 2019

What about installing babel-preset-gatsby and babel-plugin-prismjs and creating a custom .babelrc file which specifies used languages:

{
  "presets": [
    [
      "babel-preset-gatsby"
    ]
  ],
  "plugins": [
    [
      "prismjs",
      {
        "languages": [
          "javascript",
          "css",
          "markup",
          "json",
          "handlebars",
          "yaml"
        ],
        "theme": "okaidia",
        "css": true
      }
    ]
  ]
}

@aileen
Copy link
Member Author

aileen commented Apr 11, 2019

Thanks @nehalist ❤️

This absolutely works for now! Will add this to the starter soon 👍

@ScreamZ
Copy link

ScreamZ commented May 13, 2019

Any news on this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request help wanted Community project needs info
Projects
None yet
Development

No branches or pull requests

3 participants