~pythonxy/pythonxy-upstream/nbconvert

« back to all changes in this revision

Viewing changes to nbconvert/filters/filter_links.py

  • Committer: GitHub
  • Author(s): Roy Vorster
  • Date: 2022-03-22 13:11:34 UTC
  • Revision ID: git-v1:07603bab14d76870351f074f2e5a94abba0d2875
Fix links with underscore in the label conversion to latex hyperref (#1724)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
            # pandoc automatically makes labels for headings.
34
34
            label = m.group(1).lower()
35
35
            label = re.sub(r'[^\w-]+', '', label) # Strip HTML entities
 
36
            text = re.sub(r'_', '\_', text) # Escape underscores in display text
36
37
            return RawInline('tex', r'\hyperref[{label}]{{{text}}}'.format(label=label, text=text))
37
38
 
38
39
    # Other elements will be returned unchanged.