Markdown

涨见识了,在终端执行 Python 代码的 6 种方式!

帅比萌擦擦* 提交于 2020-07-25 06:14:24
原作: BRETT CANNON 译者:豌豆花下猫@Python猫 英文: https://snarky.ca/the-many-ways-to-pass-code-to-python-from-the-terminal 为了我们推出的 VS Code 的 Python 插件 [1],我写了一个 简单的脚本来生成变更日志 [2](类似于 Towncrier [3],但简单些,支持 Markdown,符合我们的需求)。在发布过程中,有一个步骤是运行 python news ,它会将 Python 指向我们代码中的"news"目录。 前几天,一位合作者问这是如何工作的,似乎我们团队中的每个人都知道如何使用 -m ?(请参阅我的有关 带 -m 使用 pip 的文章 [4],了解原因)(译注:关于此话题,我也写过一篇 更为详细的文章 ) 这使我意识到其他人可能不知道有五花八门的方法可以将 Python 指向要执行的代码,因此有了这篇文章。 1、通过标准输入和管道 因为如何用管道传东西给一个进程是属于 shell 的内容,我不打算深入解释。毋庸置疑,你可以将代码传递到 Python 中。 # 管道传内容给 python echo "print('hi')" | python 如果将文件重定向到 Python,这显然也可以。 # 重定向一个文件给 python python < spam.py

4字节emoji表情对应的Unicode编码获取和编码转换

帅比萌擦擦* 提交于 2020-07-25 01:21:53
GitHub Flavored Markdown 今天研究了一天Markdown移动端和pc端统一实现方式,由于以前有搞过移动端富文本编辑器,搞Markdown简单多了; 其中GFM的表情语法不错,比如笑脸:smile:,准备采用一下。 又想到了手机输入法输入表情浏览器页面接收到的是一个字符,如果能转换成:smile:就更能统一表现了,就像微信Android怎么输入输入法里面奇丑的emoji到了微信里面都是微信自带的好看的emoji图标,其实这个转换好几年前就有开始了解,不过没有什么进展。 编码问题 前几天刚好有需求要把emoji对应的Unicode编码转换成文字,比如1f601对应的这个笑脸😁,但没有找到C#的把1f601转换成文字的方法,用Encoding.Unicode怎么转换都不对,最后直接复制emoji字符,Visual Studio里面竟然直接显示出来了,那就直接用字符吧,都不用转换了,然后不了了之了。 今天搞Markdown编辑器,由于前面GFM的原因,又对编码进行测试,没查到什么靠谱资料,到时找到很多emoji和Unicode对照表, https://apps.timwhitlock.info/emoji/tables/unicode 拿一个笑脸 https://apps.timwhitlock.info/unicode/inspect/hex/1F601 开刀~

Caddy一个强大的web服务器和代理服务器

牧云@^-^@ 提交于 2020-07-23 23:44:34
什么是Caddy Caddy是一个强大的、可扩展的平台,可以为您的站点、服务和应用程序提供服务,它是用Go编写的。虽然大多数人使用它作为web服务器或代理,但其实他支持更多的功能: Caddy是唯一自动且默认使用HTTPS的web服务器。 web服务器 反向代理 sidecar代理 负载均衡器 API网关 ingress控制器 系统管理器 进程supervisor 任务调度器 (任何长时间运行的进程long-running process) 简单的配置与Caddyfile 强大的配置和它的原生JSON配置 使用JSON API进行动态配置 如果不喜欢JSON,配置适配器 默认自动HTTPS,让我们加密公共站点,内部名称和ip的全托管本地CA,可以与集群中的其他Caddy实例协调吗 避免其他服务器由于TLS/OCSP/与证书相关的问题而宕机时 HTTP/1.1、HTTP/2和实验性HTTP/3支持 高度可扩展的模块化架构让Caddy做任何事情都不会臃肿 在任何没有外部依赖的地方运行(甚至libc也不行) 用Go编写,一种比其他服务器具有更高内存安全保证的语言 简化的外部依赖 Caddy简化了你的基础设施。它负责TLS证书更新、OCSP绑定、静态文件服务、反向代理、Kubernetes访问等。 它的模块化架构意味着您可以使用为任何平台编译的单个静态二进制文件做更多的事情。

Is there a way in markdown to override default mathjax renderer?

好久不见. 提交于 2020-07-22 22:11:45
问题 I'm writing a slide using jupyter/markdown/mathjax/nbconvert. Turns out that the default mathjax renders poorly: The svg renderer however functions properly: Unfortunately this renderer is lost everytime I refresh the webpage. Is there a way to override this in jupyter/markdown/mathjax/nbconvert? 来源: https://stackoverflow.com/questions/54719132/is-there-a-way-in-markdown-to-override-default-mathjax-renderer

Is there a way in markdown to override default mathjax renderer?

戏子无情 提交于 2020-07-22 22:11:22
问题 I'm writing a slide using jupyter/markdown/mathjax/nbconvert. Turns out that the default mathjax renders poorly: The svg renderer however functions properly: Unfortunately this renderer is lost everytime I refresh the webpage. Is there a way to override this in jupyter/markdown/mathjax/nbconvert? 来源: https://stackoverflow.com/questions/54719132/is-there-a-way-in-markdown-to-override-default-mathjax-renderer

How to change Markdown link relative path as preprocessing of gatsby-transformer-remark

有些话、适合烂在心里 提交于 2020-07-18 21:16:32
问题 I am developping a static blog using Gatsby. It use gatsby-transformer-remark and gatsby-plugin-i18n plugin to support multiple languages. I am managing the articles in the GitHub repository as follows. /blog /2017 /06 01-foo.en.md 01-foo.zh.md /09 01-bar.en.md 01-bar.zh.md And links between the articles is necessary. Therefore, in order not to become a dead link when looking at GitHub with a Web browser, we set up a link as follows. [link](/blog/2017/09/01-bar.en.md) However, this has the

Use a variable name with spaces inline in R markdown

混江龙づ霸主 提交于 2020-07-15 07:38:57
问题 How can I include inline R code that refers to a variable name that contains spaces or other unusual characters (actual use-case is Pr(>F) )? Backticks are the solution in plain R script, but they don't seem to work when the code is inline in a markdown doc. Here's an example: ```{r} df <- data.frame(mydata= 1:10, yourdata = 20:29) names(df) <- c("your data", "my data") ``` The first five values of your data are `r df$`your data`[1:5]` Which when knitted gives: Quitting from lines 7-9 (test

Use a variable name with spaces inline in R markdown

纵饮孤独 提交于 2020-07-15 07:34:11
问题 How can I include inline R code that refers to a variable name that contains spaces or other unusual characters (actual use-case is Pr(>F) )? Backticks are the solution in plain R script, but they don't seem to work when the code is inline in a markdown doc. Here's an example: ```{r} df <- data.frame(mydata= 1:10, yourdata = 20:29) names(df) <- c("your data", "my data") ``` The first five values of your data are `r df$`your data`[1:5]` Which when knitted gives: Quitting from lines 7-9 (test

MathJax auto equation numbering does not work in Jupyter properly

孤街浪徒 提交于 2020-07-09 12:57:25
问题 I want to number the LaTeX equation, I searched internet that I shall use %%javascript MathJax.Hub.Config({ TeX:{equationNumbers:{autoNumber:'all'}} }); I tested with an equation also with \eqref{} : In equation $\eqref{eq:sample}$, we find the value of an interesting integral: \begin{equation} \int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15} \label{eq:sample}{\tag{99}} \end{equation} The output in JupyterLab is So far everything looks alright, however I start any another cell, use

Is there a pure Markdown way to include two images side by side in Jupyter?

我的未来我决定 提交于 2020-07-09 06:24:27
问题 There is a useful Python solution here to put two images side by side in the notebook, but is there a language agnostic way that does the trick using only Jupyter's own markdown? Something like ![](path/to/image1) # insert magic here # ![](path/to/image2) that displays the images side by side? This would be useful in my case cause I would prefer not to break a markdown cell into two and put code in between, but I also would find this helpful in case the notebook is not running Python. I