linky-note icon indicating copy to clipboard operation
linky-note copied to clipboard

Unable to figure out the error during linky-note apply

Open flabbergastedbd opened this issue 3 years ago • 5 comments

🐛 Bug Report

I can see that yaml frontmatter might be supported, not sure why the below file causes error.

🔬 How To Reproduce

linky-note apply with below config and markdown file errors out.

Code sample

.linky-note.yml

modify_config:
  link_system: link
  reference_by: filename
parse_config:
  parse_wikilinks: false

Sample.md

---
title: Random
date: 2020-07-02 16:57
tags: [tag]
---

## Title

Text in one big line

Some paragraph

Environment

  • OS: macOS
  • Python version, get it with: 3.9.5
linky-note apply
Traceback (most recent call last):
  File "/usr/local/bin/linky-note", line 8, in <module>
    sys.exit(app())
  File "/usr/local/lib/python3.9/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/typer/main.py", line 497, in wrapper
    return callback(**use_params)  # type: ignore
  File "/usr/local/lib/python3.9/site-packages/linky_note/entrypoints/append_linked_references.py", line 79, in main
    files = read_references(files)
  File "/usr/local/lib/python3.9/site-packages/linky_note/usecases/read_references.py", line 14, in read_references
    note, references = reference_extractor.EXTRACTOR_FACTORY(
  File "/usr/local/lib/python3.9/site-packages/linky_note/adapters/markdown/marko_extractor.py", line 29, in extract_references
    return self._extract(element=ast, references=[], parent=None)
  File "/usr/local/lib/python3.9/site-packages/linky_note/adapters/markdown/marko_extractor.py", line 60, in _extract
    self._extract_deeper(element, references)
  File "/usr/local/lib/python3.9/site-packages/linky_note/adapters/markdown/marko_extractor.py", line 78, in _extract_deeper
    self._extract(
  File "/usr/local/lib/python3.9/site-packages/linky_note/adapters/markdown/marko_extractor.py", line 56, in _extract
    self._extract(
  File "/usr/local/lib/python3.9/site-packages/linky_note/adapters/markdown/marko_extractor.py", line 62, in _extract
    raise InvalidNoteError(
linky_note.common.exceptions.InvalidNoteError: No title found in ....

📈 Expected behavior

Backlinks to be populated

📎 Additional context

linky-note 0.4.4
Python 3.9.5

flabbergastedbd avatar May 31 '21 17:05 flabbergastedbd

Hello @tunnelshade, thank you for your interest in our work!

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

github-actions[bot] avatar May 31 '21 17:05 github-actions[bot]

Unfortunately @tunnelshade yaml frontmatter is not supported right now. Could you detail why you want it supported and what is your exact use case ? I assume you are working with Jekyll ?

jb-delafosse avatar Jun 01 '21 12:06 jb-delafosse

I use zola but underlying pattern is markdown frontmatter. Support for Yaml or Toml frontmatter will be awesome as it is common across most of static site generators.

flabbergastedbd avatar Jun 01 '21 15:06 flabbergastedbd

So for the sample.md you posted earlier, the title is given in the YMF section of the document. Your usecase is you want to index your documents based on the title given in this section.

How would you reference sample.md in another file ? And what would be your workflow using linky-note ? Apply Linky note, then apply static site generation I assume.

jb-delafosse avatar Jun 01 '21 16:06 jb-delafosse

  • Links are only via filename. If title is not required for anything else (like adding in backlinks) then lack of a title can be ignored when reference_by: filename.
  • [Link](./sample.md) is the way files are referenced.
  • Workflow is apply linky note and generate static site. 💯

flabbergastedbd avatar Jun 02 '21 04:06 flabbergastedbd