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

[Feature] Add bookmarks and refer these bookmarks #390

Open
SuchiraD opened this issue Oct 24, 2024 · 0 comments
Open

[Feature] Add bookmarks and refer these bookmarks #390

SuchiraD opened this issue Oct 24, 2024 · 0 comments

Comments

@SuchiraD
Copy link
Contributor

SuchiraD commented Oct 24, 2024

Description

This is to check the feasibility of adding a custom bookmark and referring/linking it.

In docx, we can create a bookmark for places that we want to refer from somewhere else. Upon clicking the referred link, it will direct us to the bookmark. Following are few technical details.

Bookmark creation

  1. Bookmark starts with <w:bookmarkStart w:id="0" w:name="name of the bookmark"/>
  2. Bookmarks ends with <w:bookmarkEnd w:id="0"/>
  3. The required bookmark item, the <w:r></w:r> section, should be in-between <w:bookmarkStart /> and <w:bookmarkEnd />
<w:p>
    <w:bookmarkStart w:id="id-number" w:name="bookmark name" />
    <w:r>
        <w:t>Text of the bookmark</w:t>
    </w:r>
    <w:bookmarkEnd w:id="id-number" />
</w:p>

Referring bookmark

Bookmark can be linked by <w:hyperlink /> as follows

<w:p>
    <w:hyperlink w:anchor="name of the bookmark">
        <w:r>
            <w:t>Referred link name</w:t>
        </w:r>
    </w:hyperlink>
</w:p>

At the moment, the existing LINK feature in the library is only for external urls. We can extend this to Link bookmarks.

Expected Feature

  1. New command/attributes to add bookmarks.

    • +++BOOKMARK ({ name: $name_of_bookmark, label: $label_of_bookmak }) +++ . This can be used to add bookmarks to texts/formatted texts.
    • To add a bookmark to an image, +++IMAGE getImageData($image_url, $width, $height, $bookmark_name) +++. The function should return an additional parameter, bookmarkName. Then we have to place the generated image in-between <w:bookmarkStart /> and <w:bookmarkEnd />
    • To add a bookmark to a link, +++LINK ({url: $link_url, label: $label_of_link, bookmarkName: $name_of_bookmark}) +++
  2. Extend Link to refer bookmarks
    eg: +++LINK ({label: $label_of_link, bookmarkLink: $name_of_bookmark}) +++



p.s. Referred reported issue - #257 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant