idyll
idyll copied to clipboard
italicized links
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
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).
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?
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.
I'm thinking of just following the first suggestion for now. TextInline
allows for LinkInline
and I don't think we want that.
Yikes. EmInline
ultimately allows for LinkInline
anyway (via ParagraphItem
. We don't want nested links to be valid grammar.
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.