Header wrapping - markdown
At the time, the following markup:
# OPERA
BELLISSIMA
Renders into <h1>OPERA</h1>
followed by <p>BELLISSIMA</p>
. It does not look to be possible to wrap headers in any way.
I am using markdown as a book transcription format, hence I would like to make line wrap match the original book being transcribed (in order to simplify proofreading), yet I would like to render all the text without any additional wrapping — just as with the normal paragraphs.
Is it possible to achieve these using python-markdown?
6 Answer:
I did a brief research on the subject — it looks like there is no implementation which supports word wrapping in headers.
As original John Gruber's description does not say anything, this seems like a bug: as there is no blank line before the next line, it should not be considered as a new paragraph.
You are correct that the original rules do not specifically state that headers cannot wrap. However, that is how the reference implementation behaves. And when the rules aren't clear, the behavior of the reference implementation controls.
Additionally, as this has been consistent behavior for many years now, there are many thousands of documents which do not have blank lines between headers and the content that follows them. Makes such a change would break all of those documents.
For the above reasons we will not be making any such change. Of course, you are welcome to alter the behavior in an extension if you want.
Can this be done via configuration option of the Markdown class (at the time Markdown parser itself does not seem to be configurable — only extension do).
Of course I could copy-paste HashHeaderParser and alter it, but this does not seem the right thing to do.
This would need to be done via an extension which provides a new BlockProcessor
which replaces the HashHeaderProcessor
.
You can also always insert raw <br>
into your header:
>>> markdown.markdown('## OPERA<br>BELLISSIMA')
'<h2>OPERA<br>BELLISSIMA</h2>'
You can also always insert raw
<br>
into your header:>>> markdown.markdown('## OPERA<br>BELLISSIMA') '<h2>OPERA<br>BELLISSIMA</h2>'
This solves the reversed problem: I want the source to have the same layout at the original book.
I. e. compare the layout of this transcription: https://raw.githubusercontent.com/hda-technical/dancebooks/master/transcriptions/%5B1589%2C%20it%5D%20Prospero%20Lutij%20-%20Opera%20bellissima.md
with the layout of the original book: https://gallica.bnf.fr/ark:/12148/bpt6k3215756/f9.item
Read next
- Bug Report - Windows, HOME environment - Cplusplus o3de
- aiopg aiopg 1.1.0+ is incompatible with SQLAlchemy 1.4 - Python
- The app should have a single instance to access db. - BoostNote.next
- NewPipe Play protect - Java
- how to optimize for large sites - JavaScript docsy
- [Bug Report] <el-time-select> 设置了 :editable="false" 后,组件会自动变为 disabled 状态 - Vue element-plus
- PrestaShop Connections source / http referrer database index - PHP
- Halide How to best do fuzzy comparison for floats C++