-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
## Heading 2
produces <h1>Heading 2</h1>
#901
Comments
Note that this strange behavior is not reproduced in the sandbox provided here https://mystmd.org/, for which we get the more reasonable output
Therefore I think it can be considered as a real bug of MyST-Parser... |
Hey @paugier , this is not trivially possibly, without upstream modification to docutils/sphinx docutils stores documentation in a nested AST: # H1
## H2
### H3 creates <section>
H1
<section>
H2
<section>
H3 No information on the If you wanted to start at greater than ## H2
### H3
#### H4 Then it will simply get stored as: <section>
H2
<section>
H3
<section>
H4 with docutils, the HTML writer has the options; Alternatively, you could modify myst-parser, to capture the <section level=2>
H2
<section level=3>
H3
<section level=4>
H4 but then you would also need to modify the docutils/sphinx writer(s) to utilise this attribute. For your case though, it is even more problematic, what you maybe need is for myst-parser to create "phantom" sections, to allow for the correct nesting: ### Heading 3
## Heading 2
#### Heading 4 <section phatom>
<section phatom>
<section>
Heading 3
<section>
Heading 2
<section phatom>
<section>
Heading 4 You would then need to modify docutils/sphinx, to handle these phantom sections, e.g. skipping them in the HTML creation
mystmd is a separate entity to myst-parser 🙃 |
See also jgm/djot#294, I was interested what they have to say on it |
Thanks @chrisjsewell for your explanation. So it is not as simple as I thought. For the Pelican plugin using myst (myst-reader), the most important issue is that most of the time the first heading uses I think we already use Then, the question is which package/tool should be modified to fix our issue. I guess the simplest quick and dirty solution for myst-reader is to produce the html with sphinx and do few replacements when we detect it's necessary. But we could also ask sphinx to implement I would be interested to know what do you think @chrisjsewell. Aside question: do you plan to have a myst -> html converter independent of docutils and sphinx, but that would support few important (for myst) sphinx extensions? It would be great! |
The level of the first heading is taken as
<h1>
so thatproduces (with
myst_suppress_warnings: ['myst.header']
)For the Pelican plugin https://github.com/ashwinvis/myst-reader, we would need
## -> <h2>
.Is it already possible to obtain this behavior with an option?
The text was updated successfully, but these errors were encountered: