module Riffer::Rig::Terminal::Markdown::Inline
Constants
- CODE
- HYPERLINK
-
A target is written into an OSC 8 sequence only when every byte is printable ASCII, so it cannot terminate the sequence early, and only for schemes that are safe to hand to the system opener.
- SPAN_LIMIT
-
An opener with no closer is searched for one as far as its span may run, so without a ceiling a paragraph of openers costs quadratic time.
- TOKEN
-
The trailing alternative matches whatever the others donβt, so the matches tile the text and a scan sees every character exactly once.
Public Instance Methods
(String text, plain: bool, ?styles: Array[Symbol], ?url: String?) → Array[Riffer::Rig::Terminal::Markdown::Span]
Source
# File lib/riffer/rig/terminal/markdown/inline.rb, line 37 def parse(text, plain:, styles: [], url: nil) matches = text.enum_for(:scan, TOKEN).filter_map { Regexp.last_match } #: Array[MatchData] matches.flat_map { |match| token(match, plain: plain, styles: styles, url: url) } end