iamskok / gatsby-remark-code-buttons

Buttons for code snippets 🔘
https://gatsby-dev-blog-starter.netlify.com/blog/building-your-first-react-app
19 stars 9 forks source link

escape $ and code store in textarea #6

Closed Juliiii closed 4 years ago

Juliiii commented 4 years ago

The PR is to solve two cases.

1、escape $

I found an issue which is opening #2 . I think it is a common case so that i fixed it by the way.

2、code str store in textarea instead of div image

As you can see, the code str will be as a innerHTML of div element, which causes a problem. The problem is that when i copy a code like


const express = require('express')
const app = express()

app.get('/', function(req, res) {
  res.send('Hello Express')
})

// don't forget to export!
module.exports = app

and i paste it into vscode or other text editors, it will lose its format, eg:

const express = require('express') const app = express() app.get('/', function(req, res) { res.send('Hello Express') }) // don't forget to export! module.exports = app

So i change div to textarea to fix this case.

Hope to review these changes and merge these, becauce i need them recently. Thx!

Juliiii commented 4 years ago

@iamskok hi, please take time to review it, if have any problem, i will edit it. 🌹

iamskok commented 4 years ago

@Juliiii Thank you for the contribution ❤️

iamskok commented 4 years ago

3