【发布时间】:2017-08-20 13:01:16
【问题描述】:
我们有一篇用 Markdown 编写的博客文章,我们希望在托管在 GithubPages 上的 Jekyll 页面上实现该文章。
这里是帖子的降价代码摘录:
```python
import keras
```
**TensorFlow:**
```python
import tensorflow as tf
```
## Building the Model
**Keras:**
We can easily create linear to complex models through the [`sequential`](https://keras.io/models/sequential/) API, which stacks up layers in a linear fashion. For linear regression, we can write this as follow:
```python
from keras.models import Sequential
from keras.layers.core import Dense
model = Sequential()
model.add(Dense(units=1, activation="linear", input_dim=1))
```
* Keras includes many commonly used layers:
- Regular `dense` layers for feed-forward neural networks
- `Dropout`, `normalization` and `noise` layers to prevent overfitting and improve learning
- Common `convolutional` and `pooling layers` (max and average) for CNNs
- `Flatten` layers to add fully connected layers after convolutional nets
- `Embedding` layers for Word2Vec problems
- `Recurrent` layers (simpleRNN, GRU and LSTM) for RNNs
- `Merge` layers to combine more than one neural net
- Many more… you can also [write your own Keras layers](https://keras.io/layers/writing-your-own-keras-layers/)
* Many common activation functions are available like `relu`, `tanh` and `sigmoid` depending on the problem that you like to solve (read [“Yes you should understand backprop” by Andrej Karpathy](https://medium.com/@karpathy/yes-you-should-understand-backprop-e2f06eab496b) if you want to understand the effect of backpropagation on some activation functions)
* The activation function can also be passed through an `Activation` layer instead of the `activation` argument
Alternatively if you prefer one-liners, we could have also done something like this:
```python
model = Sequential([Dense(units=1, activation="linear", input_dim=1)])
```
Or we could have used [Keras’s functional API](https://keras.io/getting-started/functional-api-guide/):
```python
from keras.models import Model
from keras.layers import Dense, Input
它应该是这样的(在 README.md 中显示在 Github 上):
这是我们最终的 post.md 在托管的 Jekyll 页面上的外观:
这是 _config.yml:
title: BML
email:xxx@gmail.com
description: > # this means to ignore newlines until "baseurl:"
Write an awesome description for your new site here. You can edit this
line in _config.yml. It will appear in your document head meta (for
Google search results) and in your feed.xml site description.
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com
twitter_username: xyz
github_username: xyz
future: true
# Build settings
markdown: kramdown
highlighter: rouge
theme: minima
gems:
- jekyll-feed
exclude:
- Gemfile
- Gemfile.lock
我们花了几个小时寻找如何完成这项工作,到目前为止我们的结果和实现是:
- 似乎没有一种合理的方法可以将用 markdown 编写的帖子实现到 Jekyll 中
- 结果非常令人不快(列表混乱、代码块不是很好、奇怪的间距和垂直距离)
- 我必须实现一些
syntax.css来设置代码块样式 - Jekyll 强迫我们使用 kramdown
- markdown 到 kramdown 的转换并不容易(kramdown 在某些地方似乎有不同的语法)
我也不太明白,为什么?列表在没有任何样式的情况下呈现,尽管它们在 DOM 中正确注册为 ul li 元素。用于<ul> 元素的list-style: none; 来自呈现到网站头部的一些内联<style type="text/css">。真的不知道它来自哪里,也许是主题?
如果没有这个样式标签,至少列表看起来更好......
我尝试过使用 kramdown="1" 属性,玩弄缩进和许多其他“技巧”和结构。
- 有没有什么简单的方法可以像在 Github 上一样呈现真正的 Markdown?
- 如何知道这个奇怪的样式标签来自哪里?如何排除?
我目前正在开发的网站是: http://www.machinelearning.berlin
【问题讨论】:
-
请不要在截图中发布代码。它们无法被搜索或复制,并且可用性差。相反,将代码作为文本直接粘贴到您的问题中。如果选择它并单击
{}按钮或Ctrl+K,则代码块将缩进四个空格,这将导致其呈现为代码。 -
即使您的配置文件显示您正在使用主题
minima,您的标记屏幕截图仍显示Arcana by HTML5 UP.. 另外确保您的文件中没有 BOM 序列
标签: html css format markdown jekyll