Commit Graph

13 Commits

Author SHA1 Message Date
Jason Thompson
6373f19343 Adding CommentStrategy enum to be used in main.rs for the command flag. Putting the Regex definition in a LazyCell. Adding logic to pop off codeblocks if they are inside a comment. Adding edge case to test. 2024-08-05 23:14:30 -04:00
Thompson-Jason
b938375acc
Merge branch 'main' into remove-comments 2024-08-05 17:11:59 -04:00
Nick Groenen
fc7ebd111a
Remove some unnecessary borrows 2024-08-04 11:59:17 +02:00
Nick Groenen
da9238a78c
Use nightly rust for formatting to group import statements 2024-08-03 14:39:07 +02:00
Nick Groenen
bd1220028b
Run clippy and tests with --all-targets --all-features 2024-08-03 13:17:45 +02:00
Nick Groenen
c8cf91c0c8
Make clippy more strict 2024-08-03 11:38:20 +02:00
Jason Thompson
7912cb1f84 Adding remove_obsidian_comments postprocessor to remove obsidian format comments. 2024-07-22 21:18:28 -04:00
Martin Heuschober
018c9606a6
Implement frontmatter based filtering (#163)
This allows limiting the notes that will be exported using `--skip-tags` and `--only-tags`

---------

Co-authored-by: Martin Heuschober <martin.heuschober@posteo.net>
Co-authored-by: Nick Groenen <nick@groenen.me>
Co-authored-by: Martin Heuschober <martin_heuschober@trimble.com>
2023-12-02 11:29:29 +01:00
Robert Sesek
cd5dbf6c3b Add a lifetime annotation to the Postprocesor type
This lets the compiler reason about the lifetimes of objects used by the
postprocessor, if the callback captures variables.

See zoni/obsidian-export#175
2023-09-25 21:50:34 +02:00
Nick Groenen
d25c6d80c6 Chg: Pass context and events as mutable references to postprocessors
Instead of passing clones of context and the markdown tree to
postprocessors, pass them a mutable reference which may be modified
in-place.

This is a breaking change to the postprocessor implementation, changing
both the input arguments as well as the return value:

```diff
-    dyn Fn(Context, MarkdownEvents) -> (Context, MarkdownEvents, PostprocessorResult) + Send + Sync;
+    dyn Fn(&mut Context, &mut MarkdownEvents) -> PostprocessorResult + Send + Sync;
```

With this change the postprocessor API becomes a little more ergonomic
to use however, especially making the intent around return statements more clear.
2022-01-16 11:53:15 +01:00
Nick Groenen
84308c9f1f
New: support Obsidian's "Strict line breaks" setting
This change introduces a new `--hard-linebreaks` CLI argument. When
used, this converts soft line breaks to hard line breaks, mimicking
Obsidian's "Strict line breaks" setting.

Implementation detail: I considered naming this flag
`--strict-line-breaks` to be consistent with Obsidian itself, however I
feel the name is somewhat misleading and ill-chosen.
2022-01-02 00:42:51 +01:00
Nick Groenen
8dc7e59a79
New: support postprocessors running on embedded notes
This introduces support for postprocessors that are run on the result of
a note that is being embedded into another note. This differs from the
existing postprocessors (which remain unchanged) that run once all
embeds have been processed and merged with the final note.

These "embed postprocessors" may be set through the new
`Exporter::add_embed_postprocessor` method.
2021-09-12 14:53:27 +02:00
Nick Groenen
216179ef35
Move postprocessor tests into their own file for clarity 2021-09-12 12:50:11 +02:00