Atom-复制和粘贴时,HTML代码变为灰色(已更新代码) [英] Atom - HTML code turns gray when copying and pasting (updated with code)

查看:69
本文介绍了Atom-复制和粘贴时,HTML代码变为灰色(已更新代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题,当我将原子复制并粘贴到我的index.html文件中时,它会使html代码变成灰色.仅当我复制和粘贴时才会发生此问题.就代码而言,它似乎与任何东西都没有关系,因为无论我在从事什么项目,这种情况都会发生.如果我不复制并粘贴到Atom中,则不会发生此问题.仅当我复制和粘贴时才会发生.我最终总是遇到这个问题,因为我需要将链接复制并粘贴到引导程序,jquery等的库中.如果无法弄清楚,我将切换IDE进行Web开发实在是太麻烦了.我什至尝试卸载并重新安装Atom并没有帮助.即使它与代码无关,这也是我刚刚处理过的HTML文件.

I have this weird issue where when I copy and paste into my index.html file in atom, it makes the html code turn gray. This issue only happens when I copy and paste. It doesn't appear to be related to anything in terms of code since this happens regardless of what project I'm working on. If I don't copy and paste into Atom, this issue doesn't happen. It ONLY happens when I copy and paste. I end up running to the issue always since I need to copy and paste the links to libraries for bootstrap, jquery etc. If I can't figure it out, it's such a nuisance that I'm going to switch IDE's for web development. I've even tried uninstalling and reinstalling Atom which didn't help. Even though it's not related to code, here's an HTML file that I just worked on where it's happening.

我们非常感谢您的帮助.谢谢!

Any help is much appreciated. Thank you!

<!DOCTYPE html>
<html lang="en">

<head>
  <title>Flask App</title>
  <link rel="stylesheet" href="../static/styles/style.css" />
  <!-- jQuery UI Styles -->
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" />

  <meta name="viewport" content="width=device-width, initial-scale=1" />

  <!-- Bootstrap CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet"
    integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous" />

  <!-- Bootstrap bundle JS - includes boostrap's own JS plugins and Popper for tooltips and popovers -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js"
    integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW"
    crossorigin="anonymous"></script>
</head>

<body style="background-color: #202020; color: #fff">
  <h1 id="mainHeader">Should I buy, sell, or hold this stock?</h1>
  <div id="mainContainer" class="container">
    <form method="post" id="form">
      <!-- Enter stock symbol  -->
      <input id="stockInput" type="text" name="number" placeholder="Enter stock symbol or name..." size="30" />
      <!-- Radio buttons -->
      <div id="radioButtonContainerId">
        <p>
          <label for="isLiveFor" class="radio-inline">
            <input type="radio" name="radio" id="isLive" disabled="true" />
            Live tweets</label>
          <label for="isPastFor">
            <input type="radio" name="radio" id="isPastTweet" />
            Past tweets</label>
        </p>
      </div>

      <!-- Number of tweets  -->
      <p>
        <input id="numTweetsInput" type="number" name="numTweets" placeholder="Number of tweets" min="1"
          max="100000000000000" style="display: none" />
      </p>
      <!-- Date Range  -->
      <p>
        <input id="numDaysInput" type="number" name="numDays" placeholder="Past days" min="1" max="100000000000000"
          style="display: none" />
      </p>

      <!-- Submit Button  -->
      <p>
        <button class="btn btn-success">Submit</button>
      </p>
    </form>
  </div>

  <div class="container" id="percentResults">
    <p id="percentage"></p>
    <p id="square"></p>
  </div>

  <!-- 1. jQuery -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

  <script src="../static/custom.js"></script>
</body>

</html>

推荐答案

粘贴一些新代码后,Atom可能不会立即识别代码的语法,并且其颜色看起来是灰色的.检查屏幕的右下角,以确保原子具有正确的语言/文件扩展名.如果无法自动识别代码语言,则可以手动选择此选项.尝试手动设置从Html到Html(Go)或它可以识别的任何语法.

Atom might not be recognizing the syntax of your code immediately as soon as you paste some new code and its colour seems grey. Check the bottom right corner of the screen to make sure the atom has the correct language/file extension selected. You can manually select this if atom doesn't it automatically recognises the code language. Try setting from Html to Html(Go) manually or whichever syntax it recognises.

此外,如果文件未保存在特定的文件扩展名中,则代码将变为灰色.

Also, the code turns grey if the file is not saved in the particular file extension.

这篇关于Atom-复制和粘贴时,HTML代码变为灰色(已更新代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆