Fix permalinks with API generation for Sphinx 7.2+ (#212)
Fixes one of the issues in
https://github.com/Qiskit/documentation/issues/67, that we weren't
removing the permalink in headers with qiskit-ibm-runtime:
![screenshot_2023-10-20_at_11 17
25___am_720](https://github.com/Qiskit/documentation/assets/14852634/4fde70dc-e8c5-424f-9d34-c71cba68501a)
This change is because of
7e9a2066c2
.
Sphinx 7.2 changed the title from "Permalink" to "Link".
This commit is contained in:
parent
86c0ccd31e
commit
5e70749d29
|
@ -68,46 +68,17 @@ describe('sphinxHtmlToMarkdown', () => {
|
|||
|
||||
test('remove permalink', async () => {
|
||||
expect(
|
||||
await toMd(`<div
|
||||
role='main'
|
||||
class='main-content'
|
||||
itemscope='itemscope'
|
||||
itemtype='http://schema.org/Article'
|
||||
>
|
||||
<article itemprop='articleBody' id='pytorch-article' class='pytorch-article'>
|
||||
<section id='qiskit-ibm-runtime-api-reference'>
|
||||
<h1>
|
||||
qiskit-ibm-runtime API reference<a
|
||||
class='headerlink'
|
||||
href='#qiskit-ibm-runtime-api-reference'
|
||||
title='Permalink to this heading'
|
||||
>¶</a
|
||||
>
|
||||
</h1>
|
||||
<div class='toctree-wrapper compound'>
|
||||
<ul>
|
||||
<li class='toctree-l1'>
|
||||
<a class='reference internal' href='runtime_service.html'
|
||||
>Qiskit Runtime (<code
|
||||
class='xref py py-mod docutils literal notranslate'
|
||||
><span class='pre'>qiskit_ibm_runtime</span></code
|
||||
>)</a
|
||||
>
|
||||
</li>
|
||||
<li class='toctree-l1'>
|
||||
<a class='reference internal' href='options.html'
|
||||
>Primitive options (<code
|
||||
class='xref py py-mod docutils literal notranslate'
|
||||
><span class='pre'>qiskit_ibm_runtime.options</span></code
|
||||
>)</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
</div>
|
||||
`)
|
||||
await toMd(`<article role="main">
|
||||
<section id="qiskit-ibm-runtime-api-reference">
|
||||
<h1>qiskit-ibm-runtime API reference<a class="headerlink" href="#qiskit-ibm-runtime-api-reference" title="Link to this heading">#</a></h1>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="runtime_service.html">Qiskit Runtime (<code class="xref py py-mod docutils literal notranslate"><span class="pre">qiskit_ibm_runtime</span></code>)</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="options.html">Primitive options (<code class="xref py py-mod docutils literal notranslate"><span class="pre">qiskit_ibm_runtime.options</span></code>)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</article>`)
|
||||
).toMatchInlineSnapshot(`
|
||||
"<span id="qiskit-ibm-runtime-api-reference" />
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ export async function sphinxHtmlToMarkdown(options: {
|
|||
// remove permalink links
|
||||
$main.find('a[title="Permalink to this heading"]').remove();
|
||||
$main.find('a[title="Permalink to this definition"]').remove();
|
||||
$main.find('a[title="Link to this heading"]').remove();
|
||||
$main.find('a[title="Link to this definition"]').remove();
|
||||
|
||||
// remove download source code
|
||||
$main.find('p > a.reference.download.internal').closest('p').remove();
|
||||
|
|
Loading…
Reference in New Issue