mirror of
https://github.com/jgm/pandoc.git
synced 2026-10-29 17:52:33 +08:00
Markdown reader: avoid duplicate ids with auto_identifiers.
We previously avoided generating a duplicate with another automatically generated identifier; now we also avoid duplicates with explicit identifiers that occur before the header for which an identifier is being generated. (Collisions are still possible for identifiers that occur after the header.) T.P.Shared: `makeSections` is also modified so it doesn't give bad results when the enclosing Div has a different identifier from the header, as may now happen.
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
```
|
||||
% pandoc --wrap=preserve --file-scope command/file1.txt command/file2.txt
|
||||
^D
|
||||
<div id="command__file1.txt">
|
||||
<section id="command__file1.txt">
|
||||
<h1 id="command__file1.txt__zed">Zed</h1>
|
||||
<p><a href="bar">foo</a>
|
||||
and <a href="#command__file1.txt__zed">Zed</a>
|
||||
and <a href="#command__file2.txt__zed">other Zed</a>
|
||||
and <a href="#command__file2.txt">other file</a>
|
||||
and <a href="c.md#zed">foreign Zed</a></p>
|
||||
</div>
|
||||
<div id="command__file2.txt">
|
||||
</section>
|
||||
<section id="command__file2.txt">
|
||||
<h2 id="command__file2.txt__zed">Zed</h2>
|
||||
<p><a href="baz">foo</a></p>
|
||||
</div>
|
||||
</section>
|
||||
```
|
||||
|
||||
@@ -14,12 +14,12 @@ Ok
|
||||
:::
|
||||
^D
|
||||
<section id="hi" class="level1">
|
||||
<h1>Hi</h1>
|
||||
<h1 id="hi-1">Hi</h1>
|
||||
<section id="there" class="level2">
|
||||
<h2>there</h2>
|
||||
<h2 id="there-1">there</h2>
|
||||
</section>
|
||||
</section>
|
||||
<section id="ok" class="level1">
|
||||
<h1>Ok</h1>
|
||||
<h1 id="ok-1">Ok</h1>
|
||||
</section>
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user