idyll icon indicating copy to clipboard operation
idyll copied to clipboard

italicized links

Open kmdupr33 opened this issue 5 years ago • 6 comments

Is your feature request related to a problem? Please describe. Titles of books should be italicized. When writing, I like to make the italicized titles of books links to those books.

Describe the solution you'd like When I type, [_Book Title_](book.com), I'd like it work like this: Book Title

Describe alternatives you've considered I considered doing [em] and [a] tags inside my index.idyll, but that felt tedious.

Additional context See this editor

kmdupr33 avatar May 27 '19 16:05 kmdupr33

That described syntax works on GitHub and agree we should match.

For this to happen we'll need to update the markdown link rule to recursively parse the contained text (as done in other rules for example).

mathisonian avatar May 28 '19 02:05 mathisonian

I'm working on this, and it looks like there may need to be some grammar changes to support this.

I believe [*google*](google.com) should yield the following tokens:

LINK EM TOKEN_VALUE_START "google" TOKEN_VALUE_END EM_END TOKEN_VALUE_START "google.com" TOKEN_VALUE_END EOF

However, this doesn't appear to be valid according to grammar because of this rule:

LinkInline -> "LINK" __ TokenValue __ TokenValue

Does this seem right to you?

kmdupr33 avatar May 31 '19 04:05 kmdupr33

Ah yeah, I think your assessment is accurate.

We'd need to replace the first TokenValue with a rule that could match bold, italic etc. Something like

LinkInline -> "LINK" __ (TokenValue | BoldInline | EmInline) __ TokenValue

would work, though we should think if there are other rule's we'd want to be able to match in there. For example TextInline could be used instead, e.g.

LinkInline -> "LINK" __ (TokenValue | TextInline) __ TokenValue

if we want to match everything that textInline covers.

mathisonian avatar May 31 '19 20:05 mathisonian

I'm thinking of just following the first suggestion for now. TextInline allows for LinkInline and I don't think we want that.

kmdupr33 avatar Jun 04 '19 00:06 kmdupr33

Yikes. EmInline ultimately allows for LinkInline anyway (via ParagraphItem. We don't want nested links to be valid grammar.

kmdupr33 avatar Jun 04 '19 01:06 kmdupr33

That's a good point we defintely don't want that recursive behavior. I guess then we may have to make new rule to just match style elements that we want (em, italics) without allowing for further nesting.

mathisonian avatar Jun 07 '19 12:06 mathisonian