gpt4 book ai didi

html - Jekyll markdown 不显示像原始和一般样式问题

转载 作者:太空宇宙 更新时间:2023-11-04 08:17:50 25 4
gpt4 key购买 nike

我们有一篇用 markdown 编写的博客文章,我们想在托管在 GithubPages 上的 Jekyll 页面上实现它。

这里是帖子的 Markdown 代码摘录:

```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

它应该是这样的(显示在 Github 上的 README.md 中):

enter image description here

这是我们最终的 post.md 在托管的 Jekyll 页面上的样子:

enter image description here

这是_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 元素。 list-style: none;对于 <ul>元素来自一些内联 <style type="text/css">渲染到网站头部。真的不知道它来自哪里,也许是主题? enter image description here没有这个样式标签至少列表看起来更好......

我尝试了诸如使用 kramdown="1"属性、使用缩进和许多其他“技巧”和结构之类的方法。

  1. 是否有任何简单的方法可以像在 Github 上一样呈现真正的 markdown?
  2. 如何知道这个奇怪的样式标签来自哪里?如何排除?

我目前正在做的网站是: http://www.machinelearning.berlin

最佳答案

Jekyll 非常直接。不幸的是,一些聪明人(Jekyll 的架构师)决定创建主题并将它们与每个新元素捆绑在一起。恕我直言,这是一个很大的错误。这导致许多人从他们不理解的代码开始,更糟糕的是,他们不理解的结构。这句话完美地证明了这一点:

The list-style: none; for the ul elements comes from some inline style rendered into the websites head. Don't really know where it comes from, the main theme maybe?

所以这是给任何有类似问题并且了解基本 HTML 和 CSS 的人的信息:Jekyll 真的很简单。如果您从 Jekyll 开始,请不要使用主题。空着手开始你的元素。这种方法将为您节省大量时间和挫折感。此外,它将让您深入了解 Jekyll 是什么以及它是如何工作的。稍后你会感谢我的。

附言。回答您的问题:我可以向您保证,您的神秘代码属于您已经(未)选择的主题。

关于html - Jekyll markdown 不显示像原始和一般样式问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45782448/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com