jelovirt / org.lwdita

LwDITA parser for DITA-OT
http://lwdita.org/
Apache License 2.0
25 stars 19 forks source link

Allow continuing list from a certain index #199

Open raducoravu opened 8 months ago

raducoravu commented 8 months ago

I have this Markdown content:

# Title

1. A
2. B

```plain
hello
```

3. Some content
4. Other content

If I were to convert it to HTML, the result HTML would look like this:

<h1>Title</h1>
<ol>
<li>A</li>
<li>B</li>
</ol>
<pre><code class="language-plain">hello
</code></pre>
<ol start="3">
<li>Some content</li>
<li>Other content</li>
</ol>

so two lists with a pre in between, the second list starts from 3. The conversion to DITA looks like this:

    <ol>
        <li>A</li>
        <li>B</li>
    </ol>
    <codeblock xml:space="preserve" outputclass="plain">hello</codeblock>
    <ol>
        <li>Some content</li>
        <li>Other content</li>
    </ol>

Maybe we could add some kind of outputclass value on the second ol to state that it should start from a certain index, in this way the publishing could be customized to reflect this. Otherwise the information about the initial counter state for the second list is lost in the DITA XML content.

jelovirt commented 7 months ago

The biggest problem for me is that it would not map to standard DITA. So it would not be just configuring how Markdown structures are mapped to DITA structures, it would be extending DITA. I see @outputclass as an extension, because it's not compatible with other DITA tools anymore. For example, does Oxygen support some magic @outputclass value that effectively works like HTML5 @start?

It should probably be something like

<ol outputclass="start-3">
raducoravu commented 7 months ago
The biggest problem for me is that it would not map to standard DITA. 

Agreed, but there is also a problem if semantic meaning is lost in the conversion.

    I see @outputclass as an extension, because it's not compatible with other DITA tools anymore. 

So do I. Probably one of the most useful attributes though :)

For example, does Oxygen support some magic @outputclass value that effectively works like HTML5 @start?

No, but we were pondering about adding one.

 <ol outputclass="start-3">

Looks good.

michael-nok commented 1 month ago

Your Markdown format is invalid for the ordered list numbering to continue.

To ensure your codeblock (or any content) is considered part of 2. it must be indented using 4 spaces

# Title

1. A
2. B

    ```plain
    hello
  1. Some content
  2. Other content

Markdown syntax allows for auto-number generation, so you should consider using the one format (re: MD029)