Giter Club home page Giter Club logo

obsidian-dialogue-plugin's Introduction

Obsidian Dialogue Plugin

Create dialogues in Markdown.

dialogue

Parameters

Parameters can be set using commands inside the dialogue. All available parameters are listed in the table below.

Available parameters

Parameter Description Default Value
left: or l: Name of the dialogue participant on the left side. none
right: or r: Name of the dialogue participant on the right side. none
titleMode: Defines if and when to render titles. See available modes in the table below. first
messageMaxWidth: Defines the max message width in the dialogue. 60%
commentMaxWidth: Defines the max comment width in the dialogue. 60%

Title Modes

Mode Description
disabled Disable all titles.
first Render each title only on the first occurence.
all Always render title.

Usage

Simple usage

The message in the dialogue must be prefixed with

  • either < (message on the left side)
  • or > (message on the right side).

The message must be exactly one paragraph.

Example code

```dialogue
left: Ingmar Bergman
right: Wong Kar-wai

< Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nec tristique nunc, et pharetra sem.
< Nunc id auctor lectus, feugiat aliquet sem.

> Lorem ipsum dolor sit amet
> Ut nec efficitur mauris, a lacinia purus. Fusce nisi arcu, sollicitudin eget sodales sit amet, consectetur a lorem. Nam egestas tristique felis, sed suscipit nunc commodo nec.
```

Result

simple

Advanced parameters

All parameters listed in the table above can be used to customize the dialogue.

Example code

```dialogue
left: Ingmar Bergman
right: Wong Kar-wai
titleMode: all
messageMaxWidth: 40%

< Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nec tristique nunc, et pharetra sem.
< Nunc id auctor lectus, feugiat aliquet sem.

> Lorem ipsum dolor sit amet
> Ut nec efficitur mauris, a lacinia purus. Fusce nisi arcu, sollicitudin eget sodales sit amet, consectetur a lorem. Nam egestas tristique felis, sed suscipit nunc commodo nec.
```

Result

parameters

Change of parameters during a dialogue

Parameters can be modified during the dialogue (the change is applied to all following messages).

Example code

```dialogue
left: Ingmar Bergman
right: Wong Kar-wai

< Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nec tristique nunc, et pharetra sem.
< Nunc id auctor lectus, feugiat aliquet sem.

> Lorem ipsum dolor sit amet
> Ut nec efficitur mauris, a lacinia purus. Fusce nisi arcu, sollicitudin eget sodales sit amet, consectetur a lorem. Nam egestas tristique felis, sed suscipit nunc commodo nec.

left: Sion Sono

< Nulla condimentum orci quis enim iaculis, ut congue turpis semper. Donec mattis elit vitae risus molestie vestibulum.
< In laoreet aliquet neque, eget tempus massa congue ut.
```

Result

parameters2

Dialogue with delimiter

Use the delimiter (or shorter -) command to add a delimiter into the dialogue.

Example code

```dialogue
left: Ingmar Bergman
right: Wong Kar-wai

< Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nec tristique nunc, et pharetra sem.
< Nunc id auctor lectus, feugiat aliquet sem.

delimiter

> Lorem ipsum dolor sit amet
> Ut nec efficitur mauris, a lacinia purus. Fusce nisi arcu, sollicitudin eget sodales sit amet, consectetur a lorem. Nam egestas tristique felis, sed suscipit nunc commodo nec.
```

Result

delimiter

Dialogue with comments

Comments can be added into the dialogue with # prefix (see example below). The comment must be exactly one paragraph. Max width of the comments can be modified with the commentMaxWidth: parameter.

Example code

```dialogue
left: Ingmar Bergman
right: Wong Kar-wai

< Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nec tristique nunc, et pharetra sem.
< Nunc id auctor lectus, feugiat aliquet sem.

# Lorem ipsum dolor sit amet

> Lorem ipsum dolor sit amet

# Vivamus nunc orci, aliquet varius rutrum et, pulvinar vitae nunc. Pellentesque a consequat ipsum.

> Ut nec efficitur mauris, a lacinia purus. Fusce nisi arcu, sollicitudin eget sodales sit amet, consectetur a lorem. Nam egestas tristique felis, sed suscipit nunc commodo nec.
```

Result

comments

Custom styles for messages

Messages have special data attributes to allow custom styling.

Each message has:

  • data-participant-id attribute with a unique numeric id as a value to identify the same dialogue participant (in order of appearance, starting from number 1)
  • data-participant-name attribute with a name of the dialogue participant as a value

These attributes can be used in a CSS snippet to apply custom styles to messages based on the message author. See example below.

Specifying custom id for a dialogue particiant

To specify a custom id for a participant in the dialogue (for example if you want to have the same color for the selected participant across multiple dialogues), you can do it by appending the id to the participant definition (for example left-2: Name, where 2 is your id).

Styling example

This example sets selected background colors for the first three unique dialogue participants (in order of appearance) and also one specific color for a dialogue participant named Sion Sono.

/* messages from first dialogue participant will have #f00 background color */
.dialogue-plugin-message[data-participant-id="1"] {
	background-color: #f00;
}

/* messages from second dialogue participant will have #0f0 background color */
.dialogue-plugin-message[data-participant-id="2"] {
	background-color: #0f0;
}

/* messages from third dialogue participant will have #00f background color */
.dialogue-plugin-message[data-participant-id="3"] {
	background-color: #00f;
}

/* messages from dialogue participant named 'Sion Sono' will have #f0f background color */
.dialogue-plugin-message[data-participant-name="Sion Sono"] {
	background-color: #f0f;
}

Say Thanks ๐Ÿ™

If you like this plugin and would like to support its development, you can buy me a coffee!

Buy Me A Coffee

obsidian-dialogue-plugin's People

Contributors

holubj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

obsidian-dialogue-plugin's Issues

Great taste!

Bergman, Wong kar-wai and Sion Sono!
The only mistake in the Read Me file is that there is no actual text - that would have been one hell of an interesting conversation ;-)

Support for Profile Pictures

I'd love to see the ability to define profile pictures for each speaker that would display next to text, like so:
SCR-20220517-e2d

Wiki links within dialogues?

Hello there, thanks for this great and useful plugin. I am wondering if wiki links can be included within the conversation? Thanks!

Line breaks in messages

Hi, is there a way to do line breaks in a message?

I just recently discovered the plugin and it is really great! Thank you for making it โค๏ธ

Easier way to add colors

Is it possible to specify the color directly in the dialogue block. Have a syntax such as:

define color #FF0000 Alexei 
define color #FF1100 Marie
left: Alexei
right:  Marie

< Helloo
> Hi

OR

define color #FF0000 id-1
define color #FF1100 id-2
left-1: Alexei
right-2:  Marie

< Helloo
> Hi

Or maybe instead of adding all the css colors in one single styles.css, there can be a folder called styles where we can add css files

[Feature request] Multiple dialogue happening simultaneously

Just a thought. I'm thinking something like when two (sometimes more) characters are saying different things at the same time or are overlapping each other; something like these:

image
image

Two messages being shown on each side, rather than the usual one message at a time, so the text would wrap around the middle. Would be cool to have this feature

Multiple lines in a message

Is it possible to have an explicit line break in a message?
Like

"Dear XXX,
Lorem ipsum..."

as one message?

Press Enter to Change Character

I updated today this precious plugin and noticed that in Version 1.0.2 pressing Enter after > (right character) a new dialoque line begins with the same right character.
I think that could be better to alternate voices in a dialogue pressing Enter.

<Alice words
Enter

Luca words
Enter
<Alice words
Enter
Luca words

Maybe one could use Shift + Enter to mantain the same character.

Now pressing Enter the same character goes on speaking and one have to press Enter twice in order to set < to make speak the left character.

Thank you very much!!!

Schermata 2022-06-16 alle 22 14 18

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.