Skip to content

feat(editorial): add :Leet editorial command - #230

Open
thecuriousone25 wants to merge 1 commit into
kawre:masterfrom
thecuriousone25:feat-editorial
Open

feat(editorial): add :Leet editorial command#230
thecuriousone25 wants to merge 1 commit into
kawre:masterfrom
thecuriousone25:feat-editorial

Conversation

@thecuriousone25

Copy link
Copy Markdown

Open a problem's official solution article (editorial) in a floating popup, styled like :Leet info / :Leet hints.

What it does

  • api: question.editorial(slug) via ugcArticleOfficialSolutionArticle and question.playground(uuid) via allPlaygroundCodes. Both tolerate null/missing GraphQL data and malformed responses.
  • ui: new Editorial popup (leetcode-ui/popup/editorial.lua) with a self-contained markdown renderer (headings, lists, blockquotes, rules, fenced code, inline emphasis). Each editorial <iframe> playground embed is replaced inline with its actual code, fetched from the playground API, as a fenced code block. Content loads lazily on first open.
  • premium: editorials are only sometimes premium-gated. The fetch is skipped only when a paid-only problem meets a non-premium user (per config.auth.is_premium); every other case is fetched and falls back to "No editorial available" if declined, so public editorials on free problems still load.

Usage

:Leet editorial while a problem is open.

Open a problem's official solution article in a floating popup.

- api: `question.editorial` (ugcArticleOfficialSolutionArticle) and
  `question.playground` (allPlaygroundCodes); both tolerate null/missing
  GraphQL data.
- ui: `Editorial` popup renders the article's markdown and inlines each
  playground `<iframe>` as a fenced code block. Inline/display LaTeX
  (`$...$`, `$$...$$`) is normalized to plain text/Unicode.
- premium: skip the fetch only when a paid-only problem meets a non-premium
  user; otherwise fetch and fall back to "No editorial available".
@thecuriousone25

Copy link
Copy Markdown
Author

@kawre Can you please take a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant