`markdownify.markdownconverter` - невозможно изменить поведение` convert_hn`Html

Программисты Html
Anonymous
`markdownify.markdownconverter` - невозможно изменить поведение` convert_hn`

Сообщение Anonymous »

Вот m (не) мы, где изменение Convert_hn кажется сломанным. Почему? < /P>
from markdownify import MarkdownConverter

class CustomMarkdownConverter(MarkdownConverter):
def convert_hN(self, n, el, text, parent_tags):
title = super().convert_hN(n, el, "text", parent_tags)

return f"BUG: {title}"

def custom_markdownify(html):
return CustomMarkdownConverter().convert(html)

html = """
Section 1
Section 2
Sub Section 3.1
"""

print(custom_markdownify(html))
< /code>
Это печатает < /p>
Section 1
=========

Section 2
---------

### Sub Section 3.1
< /code>
вместо < /p>
BUG: Section 1
==============

BUG: Section 2
--------------

### BUG: Sub Section 3.1


Подробнее здесь: https://stackoverflow.com/questions/796 ... of-convert

Вернуться в «Html»