Skip to content
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

Markdown heading does not correspond to right HTML Section Heading elements #6577

Open
kittauri opened this issue Jan 10, 2025 · 3 comments · May be fixed by #6588
Open

Markdown heading does not correspond to right HTML Section Heading elements #6577

kittauri opened this issue Jan 10, 2025 · 3 comments · May be fixed by #6588

Comments

@kittauri
Copy link

Describe the bug
A single # in the textblock generates a h2 in HTML. It is not a direct bug but a wrong implementation of Markdown, as it is intentional in there.

export const autoformatRules = [
{
type: H2,
markup: '#',
},
{
type: H3,
markup: '##',
},

I know that you want to limit titles to an h2 heading, but a user may expect to have an h1 with single #.

To Reproduce
Steps to reproduce the behavior:

  1. Create a heading in a text field with a #
  2. Inspect the Element with the Developer Tools
  3. You see the mismatch between documentation, the generated HTML and the specification

Expected behavior

A single # should generate a h1 and two # should generate a h2 etc.

As stated in the specification:
https://spec.commonmark.org/0.31.2/#atx-heading
or here
https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#headings

Screenshots
markdown_error

Software (please complete the following information):

  • OS: Linux
  • Browser: Chrome (Version 131.0.6778.264 (Official Build) (64-bit))
  • Volto 18.4.0
  • Plone 6.1.0b2
  • plone.restapi 9.9.0

Additional context
There is the intention to prevent the editor from creating to much h1 headings so it is not clearly a bug but a feature, but it is wrong implementation.

@davisagli
Copy link
Member

This is by design. h1 is reserved for the heading created by the title block, and there should not be more than one h1 on a single page.

@erral
Copy link
Member

erral commented Jan 10, 2025

Then perhaps we should not allow # but use ## for h2 and ### for h3, right?

@davisagli
Copy link
Member

@erral That does sound like it would be a bit more consistent with what is actually rendered.

javatcoding1 pushed a commit to javatcoding1/volto that referenced this issue Jan 12, 2025
This was referenced Jan 12, 2025
@Shyam-Raghuwanshi Shyam-Raghuwanshi linked a pull request Jan 13, 2025 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants