Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement request: Link to a specific heading in a document #20

Closed
JenniBeadle opened this issue Nov 10, 2022 · 6 comments
Closed

Enhancement request: Link to a specific heading in a document #20

JenniBeadle opened this issue Nov 10, 2022 · 6 comments
Assignees
Labels

Comments

@JenniBeadle
Copy link

JenniBeadle commented Nov 10, 2022

At present links to documents are supported but only to the whole document. It would be nice to link to a specific heading either in the same document or another document.

How to do it in Docusaurus
Docusaurus allows this by adding a code to the (destination) heading {#...} and then including that code in the link.
For example, see https://manual.paratext.org/Training-Manual/Stage-1/OD

In chapter 2 under 2.3 Create a new text layout I have a link to section 2.5
... ≡ Paratext menu, under (Paratext > Open, select several resources, choose to open as Text collection. See [2.5]

Heading 2.5 is coded as:
### 2.5 Open resources in a Text collection {#25}
The link is coded as:
See [2.5] (/Training-Manual/02-Stage-1/2.OD.md#25)
(the link is broken to display the coding)

Note: I have the code without decimal points otherwise it didn't work reliably.

Docusaurus documentation
see https://docusaurus.io/docs/markdown-features/toc#example-subsubsection-1-a-ii for a discussion on setting an explicit heading id.

@andrew-polk
Copy link
Contributor

@JenniBeadle
I've been working on this today.
I have a couple questions.

  1. Do you need/want to be able to control what the ID is?
    For example, do you need #25?
    Or is it just as good to have something like #ff612bfc-2d1d-4f86-8dbc-54ca34ae0f38?
  2. Do you need the links to work internally in Notion? Or only in Docusaurus?

I don't think I can provide both custom IDs and internal linking in Notion.

So the options I see are:

  1. User provides the link ID in Notion the same way as in Docusaurus -- by adding {$my-id}. Notion links to headings will not navigate correctly within Notion.
  2. User creates links using the notion system of internal IDs (which look like ff612bfc-2d1d-4f86-8dbc-54ca34ae0f38). Those will flow through to Docusaurus as the IDs to use. Thus the urls will end with that ID rather than something the user can define.
  3. Allow for both. If the user supplies an ID, use it. If not, use Notion IDs.

@hatton
Copy link
Member

hatton commented Dec 1, 2022

The docu-notion way is that you use Notion links, and it just works. Document writers should not see or care. Is that what #2 means?

@JenniBeadle
Copy link
Author

JenniBeadle commented Dec 1, 2022 via email

@andrew-polk
Copy link
Contributor

The docu-notion way is that you use Notion links, and it just works. Document writers should not see or care. Is that what #2 means?

Yes.
@hatton

@andrew-polk
Copy link
Contributor

@JenniBeadle
Ok, thanks for helping me understand your use case better.

andrew-polk added a commit that referenced this issue Dec 1, 2022
feat: Make heading links work (#20)
@andrew-polk
Copy link
Contributor

Added in cc93d95 for 0.7.0

@andrew-polk andrew-polk self-assigned this Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants