lepture/mistune

No renderer "'strikethrough'"

Closed this issue · 1 comments

README.md

h1 标题

h2 标题

h3 标题

h4 标题

h5 标题
h6 标题

水平线




文本样式

This is bold text

This is bold text

This is italic text

This is italic text

Strikethrough

列表

无序

  • Create a list by starting a line with +, -, or *
  • Sub-lists are made by indenting 2 spaces:
    • Marker character change forces new list start:
      • Ac tristique libero volutpat at
      • Facilisis in pretium nisl aliquet
      • Nulla volutpat aliquam velit
  • Very easy!

有序

  1. Lorem ipsum dolor sit amet

  2. Consectetur adipiscing elit

  3. Integer molestie lorem at massa

  4. You can use sequential numbers...

  5. ...or keep all the numbers as 1.

Start numbering with offset:

  1. foo
  2. bar

代码

Inline code

Indented code

// Some comments
line 1 of code
line 2 of code
line 3 of code

Block code "fences"

Sample text here...

Syntax highlighting

var foo = function (bar) {
  return bar++;
};

console.log(foo(5));

$ python -m mistune -f README.md -r markdown -o README.md
Traceback (most recent call last):
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/core.py", line 190, in _get_method
return object.getattribute(self, name)
AttributeError: 'MarkdownRenderer' object has no attribute 'strikethrough'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/main.py", line 124, in
cli()
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/main.py", line 108, in cli
text = md.read(args.file)[0]
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/markdown.py", line 105, in read
return self.parse(s, state)
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/markdown.py", line 90, in parse
result = self.render_state(state)
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/markdown.py", line 48, in render_state
return self.renderer(data, state)
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/renderers/markdown.py", line 16, in call
out = self.render_tokens(tokens, state)
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/core.py", line 206, in render_tokens
return ''.join(self.iter_tokens(tokens, state))
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/core.py", line 203, in iter_tokens
yield self.render_token(tok, state)
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/core.py", line 199, in render_token
return func(token, state)
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/renderers/markdown.py", line 87, in paragraph
text = self.render_children(token, state)
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/renderers/markdown.py", line 33, in render_children
return self.render_tokens(children, state)
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/core.py", line 206, in render_tokens
return ''.join(self.iter_tokens(tokens, state))
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/core.py", line 203, in iter_tokens
yield self.render_token(tok, state)
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/core.py", line 198, in render_token
func = self._get_method(token['type'])
File "/home/yczx/.local/lib/python3.10/site-packages/mistune/core.py", line 194, in _get_method
raise AttributeError('No renderer "{!r}"'.format(name))
AttributeError: No renderer "'strikethrough'"

strikethrough is a plugin, you need to customize the MarkdownRenderer, and add the method to render strikethrough.