clockoon / dokuwiki-plugin-commonmark

Commonmark plugin for Dokuwiki
https://www.dokuwiki.org/plugin:commonmark
8 stars 3 forks source link

Section edit uses wrong boundaries #20

Open pludov opened 1 year ago

pludov commented 1 year ago

Edition of a markdown delimited sub-section is broken.

Consider the following markdown page:

# Section 1

## Sub section 1.1

Some text in this section

## Sub section 1.2

Other text there

Click on edit for Sub section 1.1 will edit the follow part (obviously not the exact section boundaries):

tion 1.1

Some text in this section

## Sub section 1.
u35253 commented 7 months ago

Concurrence

I observe this also. With the "DokuWiki Commonmark Plugin" plugin in DokuWiki 2023-04-04 "Jack Jackrum", when using the "Edit" button for a section, the boundaries are slightly off, which results actually in messing up the page when saving, etc.

Temporary workaround

What I do for now is to prevent section edits, so that other editors (or I) do not have to know or remember to avoid using section Edit feature (which is awfully tempting/convenient otherwise). This is achieved by setting the admin configuration option "maxseclevel" ("Maximum section edit level") to 0 from the admin UI.

Future outlook

Ideally it would be great to get section editing working seamlessly with Commonmark in DokuWiki.

For now I am just thrilled that Commonmark is so reliable and consistent and easy. I'm ok living without the Section Edit feature, just to have Commonmark. But this is definitely some kind of bug, that theoretically really should be fixed, if anyone is capable of figuring it out. Thank you.

clockoon commented 6 months ago

Unfortunately, Dokuwiki in principle determines the section range via rendered DW text, not from original Markdown text. This mechanism is included in DW's core, and cannot handle by plugin as far as I know (see #1, #2, etc.). If someone proposes the workarounds it will be very helpful for resolve the section edit issue.