hugo - 如何通过文本编辑器嵌入代码?
问题描述
我正在运行 Hugo 并使用 Notepad++ 编辑我的页面。我想在这里嵌入一些类似于页面的代码。
我的雨果版本是
Hugo Static Site Generator v0.55.6-A5D4C82D windows/amd64 BuildDate: 2019-05-18T07:57:00Z
我的 config.toml 文件在下面。如您所见,我已将 pygments 选项添加到页面顶部:
pygmentsCodefences = true
pygmentsStyle = "autumn"
baseurl = "https://blakeshurtz.netlify.com/"
title = "Blake Shurtz"
theme = "hugo-creative-portfolio-theme"
languageCode = "en-us"
# Enable comments by entering your Disqus shortname
disqusShortname = ""
# Enable Google Analytics by entering your tracking code
googleAnalytics = ""
[params]
# Style options: default (pink), blue, green, pink, red, sea, violet
# Use custom.css for your custom styling
style = "default"
description = "Describe your website"
copyright = "©2019 Blake Shurtz"
sidebarAbout = [
"I am a research statistician who enjoys building models and apps.",
"Originally from the Bay Area, currently based in central CA."
]
# Contact page
# Since this template is static, the contact form uses www.formspree.io as a
# proxy. The form makes a POST request to their servers to send the actual
# email. Visitors can send up to a 1000 emails each month for free.
#
# What you need to do for the setup?
#
# - set your email address under 'email' below
# - upload the generated site to your server
# - send a dummy email yourself to confirm your account
# - click the confirm link in the email from www.formspree.io
# - you're done. Happy mailing!
email = "you@yoursite.com"
# Optional Matomo analytics (formerly piwik)
# [params.analytics.matomo]
# URL = "https://stats.example.com"
# ID = "42"
# # Track all subdomains with "*.example.com" (Optional)
# domain = "www.example.com"
# # Optional integrity check hash
# hash = ""
# Nav links in the side bar
[[params.navlinks]]
name = "Home"
url = "portfolio/"
home = true
[[params.navlinks]]
name = "About"
url = "about/"
[[params.navlinks]]
name = "Get in touch"
url = "contact/"
[params.social]
stackoverflow = "https://stats.stackexchange.com/users/206673/blake-shurtz"
twitter = "https://twitter.com/blakeobeans"
email = "blakeobeans@gmail.com"
linkedin = "https://www.linkedin.com/in/blakeshurtz/"
github = "https://github.com/blakeobeans"
有人可以给我一个示例,说明我需要在文本编辑器中编写什么以包含代码吗?
谢谢!
解决方案
我假设您的意思是使用降价语法将文本格式化为代码。
在开头和结尾处用三个反引号包围您的代码。
```python (or whatever language)
code here
```
推荐阅读
- ionic3 - ionic3 - inappBrowser - IOS 文件不加载
- javascript - 从部分响应中播放音频并在完成后保存缓冲区
- spring-mvc - Spring Thymeleaf 依赖覆盖 Eureka 模板?
- r - R ggplot2 两级分面换行
- php - Symfony 嵌入式表单
- asp.net-core - ASP.NET CORE 2.0 分布式会话管理与 AWS DynamoDB
- c# - 在不带括号的 DataGridView 中显示负值
- cmake - CPack 子项目和公共标头
- mysql - 使用 mysql 连接查询选择数据
- react-native - 实施来自 salesforce Marketing Cloud 的推送通知以响应本机移动应用程序