automatically, the address is replaced with 'html#id1' like this.

39 views
Skip to first unread message

Orang Gendut Korea

unread,
Feb 11, 2020, 9:33:04 PM2/11/20
to sphinx-users
Hello~!

I'm migrating our local html file to sphinx...

but the address is automatically replaced with #id1 , #id2, #id3 .... 

I don't know how to make it ...

My problem

My expectation

I attached my rst file.

Capture.JPG


Komiya Takeshi

unread,
Feb 12, 2020, 9:56:48 AM2/12/20
to sphinx...@googlegroups.com
Hi,

Sphinx and docutils (reStructuredText library) generate element ID automatically. So it is difficult to control them from markups. Usually, these tools uses section titles to generate element IDs. But they except all element IDs should start with alphabets, not numbers.

Thanks,
Takeshi KOMIYA

2020年2月12日(水) 11:33 Orang Gendut Korea <ybs...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/d859a6a7-e051-4ed7-9ab5-fb5e72522bff%40googlegroups.com.

Peter Burdine

unread,
Feb 12, 2020, 12:46:29 PM2/12/20
to sphinx-users
You *could* make it do that, but then you would make making your own anchors for each section:

.. _1101:

1101
----

..raw:: html
   
:file: _static/1101.html


Stefano David

unread,
Feb 16, 2020, 5:51:51 AM2/16/20
to sphinx-users
Hello,

Unfortunately, it appears to me that it is not possible to generate anchors that start with a number. This code

.. _1101:

test
----

.. _a1101:

toast
-----

generates this html:

<div class="section" id="test">
<span id="id1"></span><h1>test<a class="headerlink" href="#test" title="Permalink to this headline">¶</a></h1>
</div>
<div class="section" id="toast">
<span id="a1101"></span><h1>toast<a class="headerlink" href="#toast" title="Permalink to this headline">¶</a></h1>
</div>

The first anchor will still receive an autogenerated id.

Best regards,
Stefano
Reply all
Reply to author
Forward
Message has been deleted
0 new messages