Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat #879: Note Embedding Syntax #1281

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/assets/images/note-embed-type-demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions docs/user/features/built-in-note-embedding-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Built-In Note Embedding Types

When embedding a note, there are a few ways to modify the scope of the content as well as its display style. The following are Foam keywords that are used to describe note embedding.

Note, this only applies to note embedding, not embedding of attachments or images.

![Note Embed Types GIF](../../assets/images/note-embed-type-demo.gif)

## Scope

- `full` - the entire note in the case of `![[note]]` or the entire section in the case of `![[note#section1]]`
- `content` - everything excluding the title of the section. So the entire note minus the title for `![[note]]`, or the entire section minus the section header for `![[note#section1]]`

## Style

- `card` - outlines the embedded note with a border
- `inline` - adds the note continuously as if the text were part of the calling note

## Default Setting

Foam expresses note display type as `<scope>-<style>`.

By default, Foam configures note embedding to be `full-card`. That is, whenever the standard embedding syntax is used, `![[note]]`, the note will have `full` scope and `card` style display. This setting is stored under `foam.preview.embedNoteStyle` and can be modified.

## Explicit Modifiers

Prepend the wikilink with one of the scope or style keywords, or a combination of the two to explicitly modify a note embedding if you would like to override the default setting.

For example, given your `foam.embedNoteStyle` is set to `content-card`, embedding a note with standard syntax `![[note-a]]` would show a bordered note without its title. Say, for a specific `note-b` you would like to display the title. You can simply use one of the above keywords to override your default setting like so: `full![[note-b]]`. In this case, `full` overrides the default `content` scope and because a style is not specified, it falls back to the default style setting, `card`. If you would like it to be inline, override that as well: `full-inline![[note-b]]`.
13 changes: 8 additions & 5 deletions docs/user/features/including-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ Including a note can be done by adding an `!` before a wikilink definition. For

## Custom styling

Displaying the inclusion of notes allows for some custom styling, see [[custom-markdown-preview-styles]]
To modify how an embedded note looks and the scope of its content, see [[built-in-note-embedding-types]]

For more fine-grained custom styling, see [[custom-markdown-preview-styles]]

## Future possibilities

Work on this feature is evolving and progressing. See the [[inclusion-of-notes]] proposal for the current discussion.

[//begin]: # "Autogenerated link references for markdown compatibility"
[custom-markdown-preview-styles]: custom-markdown-preview-styles.md "Custom Markdown Preview Styles"
[inclusion-of-notes]: ../../dev/proposals/inclusion-of-notes.md "Inclusion of notes Proposal "
[//end]: # "Autogenerated link references"
[//begin]: # 'Autogenerated link references for markdown compatibility'
[built-in-note-embedding-types]: built-in-note-embedding-types.md 'Built-In Note Embedding Types'
[custom-markdown-preview-styles]: custom-markdown-preview-styles.md 'Custom Markdown Preview Styles'
[inclusion-of-notes]: ../../dev/proposals/inclusion-of-notes.md 'Inclusion of notes Proposal '
[//end]: # 'Autogenerated link references'
6 changes: 0 additions & 6 deletions packages/foam-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -609,12 +609,6 @@
],
"description": "Whether or not to navigate to the target daily note when a daily note snippet is selected."
},
"foam.preview.embedNoteInContainer": {
"type": "boolean",
"default": true,
"description": "Wrap embedded notes in a container when displayed in preview panel",
"deprecationMessage": "*DEPRECATED* use foam.preview.embedNoteType instead."
},
"foam.preview.embedNoteType": {
"type": "string",
"default": "full-card",
Expand Down
Loading
Loading