I think I wrote something similar before. The plain Markdown is a little tight, isn't it? So I'll bring Pelican's Markdown closer to GFM. There is almost no difference.
It's Pelican, or the general story when using Python's Markdown library.
Install the following packages.
$ pip install mdx_linkify
$ pip install mdx_del_ins
Add the following to pelicanconf.py.
MD_EXTENSIONS = ['linkify', 'del_ins', 'fenced_code', 'codehilite(css_class=highlight)', 'tables']
That's it.
Goodbye here except for those who want to take a closer look.
Ordinary Markdown is sad when there are multiple Ansco (_) in a word.
wow_great_stuff is like wow great </ em> stuff.
Some people may find this funky and good, but usually I don't like it. So first try not to do this.
If you think, Markdown in Python already has this feature. I'm glad I didn't do anything!
Congratulations!
goodbye!
Hello!
You do this when you put a link.
[http://example.com](http://example.com)
Is this all right? Is the front one rounder? That? It's a pain to get confused soon. It looks like it's crazy. After all, I would like you to be careful and give consideration to automatic linking. I'm paying for this. I didn't pay.
Unfortunately, this is not possible with standard features alone. You can write your own extensions with regular expressions, but There is a good third-party extension called ** mdx_linkify **, so let's use it.
If you install it stylishly like this with pip,
$ pip install mdx_linkify
Write this in pelicanconf.py:
MD_EXTENSIONS = ['linkify']
In GFM
~~Black history~~
By doing so, you can strike through ~~ Black History ~~ like this. Like this ... that? Hasn't it disappeared? My black history hasn't disappeared, right? Apparently it doesn't work with Markdown here either.
Midnight sun, jet-black darkness. Yes, I am a fallen angel. Look at your profile in the seat next to you. Huhuhu, you don't know the true me yet. </ del>
Hmm, it's dangerous.
Well, unfortunately this is not possible with standard features alone. Use the extension ** mdx_del_ins **.
$ pip install mdx_del_ins
pelicanconf.py looks like this.
MD_EXTENSIONS = ['linkify', 'del_ins']
Markdown uses indentation to represent code blocks, but GFM's three backticks are no longer the de facto momentum.
Here's an example:
```
function test() {
console.log("notice the blank line before this function?");
}
```
It uses the standard built-in extension ** Fenced Code Blocks **.
pelicanconf.py will be enriched little by little.
MD_EXTENSIONS = ['linkify', 'del_ins', 'fenced_code']
The program has nothing to do with an ignorant person like me who doesn't know anything about it, There seems to be a function called syntax highlighting. I'm stupid, I don't know what to use it for, but it seems that I can do this.
```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
```
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
Shouldn't we just silently add ** CodeHilite **!
MD_EXTENSIONS = ['linkify', 'del_ins', 'fenced_code', 'codehilite(css_class=highlight)']
By writing like this, the table will be hung.
item | expenses
------------- | -------------
TENGA | 606
TENGA HARD | 655
item | expenses |
---|---|
TENGA | 606 |
TENGA HARD | 655 |
** Tables ** in the direction of addition.
MD_EXTENSIONS = ['linkify', 'del_ins', 'fenced_code', 'codehilite(css_class=highlight)', 'tables']
With the settings up to this point, you can use it in the same way as GFM! By the way, Pelican has codehilite and extra enabled as default extensions.
The reason why I specified codehilite with (css_class = highlight)
was to avoid CSS not working effectively due to the difference between the default specification and the class.
By the way, extra is not specified in this example, but extra has other useful functions.
The MD_EXTENSIONS
is overwritten rather than added, thus disabling the extra feature.
If you want extra functionality, add it.
Click here for details. http://pythonhosted.org/Markdown/extensions/
Recommended Posts