markdown-github-bear-toc icon indicating copy to clipboard operation
markdown-github-bear-toc copied to clipboard

Problem with md_text string

Open denostr opened this issue 4 years ago • 1 comments

Running markdown-toc from example, with note name or with UUID, result the same.

Python 3.9.10

$ markdown-toc -h 3 -t bear "D59BF56B-A152-46A8-A513-B043C1BD6BEC-3815-00000012FB42BD77"
Traceback (most recent call last):
  File "/opt/homebrew/bin/markdown-toc", line 4, in <module>
    markdowntoc.main()
  File "/opt/homebrew/lib/python3.9/site-packages/markdowntoc/markdowntoc.py", line 295, in main
    md_text_toc_pairs, identifiers = create_table_of_contents_bear()
  File "/opt/homebrew/lib/python3.9/site-packages/markdowntoc/markdowntoc.py", line 199, in create_table_of_contents_bear
    notes = get_notes_from_bear()
  File "/opt/homebrew/lib/python3.9/site-packages/markdowntoc/markdowntoc.py", line 64, in get_notes_from_bear
    return list(filter(lambda note: match_title_uuid_tag(note), notes))
  File "/opt/homebrew/lib/python3.9/site-packages/markdowntoc/markdowntoc.py", line 64, in <lambda>
    return list(filter(lambda note: match_title_uuid_tag(note), notes))
  File "/opt/homebrew/lib/python3.9/site-packages/markdowntoc/markdowntoc.py", line 58, in match_title_uuid_tag
    note_tags = get_tags_in_note(note['ZTEXT'])
  File "/opt/homebrew/lib/python3.9/site-packages/markdowntoc/markdowntoc.py", line 75, in get_tags_in_note
    lines_iter = iter(md_text.splitlines())
AttributeError: 'NoneType' object has no attribute 'splitlines'

denostr avatar Jan 27 '22 14:01 denostr

got same results after locking a note with password. I've disabled password locked notes and the script started working again, guess there's some global change to the note retrieval when some notes where locked by pw.

from the error message itself it can be Implied that the program cannot fetch the markdown text properly, so it returns nothing, rather than the note. Thus no TOC can be generated from nothing.

hope that helps

Din0-3 avatar Sep 09 '22 11:09 Din0-3