Commit Graph

6 Commits

Author SHA1 Message Date
Nick Groenen
6033407266
new: support links referencing headings
Previously, links referencing a heading (`[[note#heading]]`) would just
link to the file name without including an anchor in the link target.
Now, such references will include an appropriate `#anchor` attribute.

Note that neither the original Markdown specification, nor the more
recent CommonMark standard, specify how anchors should be constructed
for a given heading.

There are also some differences between the various Markdown rendering
implementations.

Obsidian-export uses the [slug] crate to generate anchors which should
be compatible with most implementations, however your mileage may vary.

(For example, GitHub may leave a trailing `-` on anchors when headings
end with a smiley. The slug library, and thus obsidian-export, will
avoid such dangling dashes).

[slug]: https://crates.io/crates/slug
2021-01-04 21:45:00 +01:00
Nick Groenen
fcb4cd9dec
new: support embeds referencing headings
Previously, partial embeds (`![[note#heading]]`) would always include
the entire file into the source note. Now, such embeds will only include
the contents of the referenced heading (and any subheadings).

Links and embeds of [arbitrary blocks] remains unsupported at this time.

[arbitrary blocks]: https://publish.obsidian.md/help/How+to/Link+to+blocks
2021-01-04 19:12:51 +01:00
Nick Groenen
6245c9a31d
Fix: correct relative links within embedded notes
Links within an embedded note would point to other local resources
relative to the filesystem location of the note being embedded.

When a note inside a different directory would embed such a note, these
links would point to invalid locations.

Now these links are calculated relative to the top note, which ensures
these links will point to the right path.
2020-12-22 12:42:07 +01:00
Nick Groenen
3b46d6b7d1
New: Report file tree when RecursionLimitExceeded is hit
This refactors the Context to maintain a list of all the files which
have been processed so far in a chain of embeds. This information is
then used to print a more helpful error message to users of the CLI when
RecursionLimitExceeded is returned.
2020-12-21 13:54:30 +01:00
Nick Groenen
2edc2e87fb
Add more reliable non-ASCII tetscase 2020-12-07 23:32:25 +01:00
Nick Groenen
c2de776148
Public release 2020-12-07 22:35:57 +01:00