Skip to content

Commit

Permalink
Include section ids in LinkedHeadingBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
sHermanGriffiths committed Aug 26, 2024
1 parent 520a91c commit e794322
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions n2y/plugins/linkedheaders.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
from n2y.blocks import HeadingBlock

from pandoc.types import Header, Link

from n2y.blocks import HeadingBlock
from n2y.utils import header_id_from_text


class LinkedHeadingBlock(HeadingBlock):
"""
Make headers have links back to the originating notion block.
"""

def to_pandoc(self):
section_id = header_id_from_text(self.rich_text.to_plain_text())
link = [Link(("", [], []), self.rich_text.to_pandoc(), (self.notion_url, ""))]
return Header(self.level, ("", [], []), link)
return Header(self.level, (section_id, [], []), link)


class LinkedHeadingThreeBlock(LinkedHeadingBlock):
Expand Down

0 comments on commit e794322

Please sign in to comment.