-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: automatically track open-source libraries for web frontend (#279)
- Loading branch information
1 parent
9c0d4a3
commit d9c0352
Showing
9 changed files
with
303 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/- | ||
Copyright (c) 2025 Lean FRO LLC. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Author: David Thrane Christiansen | ||
-/ | ||
|
||
import Verso | ||
|
||
import VersoManual.Basic | ||
import VersoManual.License | ||
|
||
namespace Verso.Genre.Manual | ||
|
||
open Verso.Code | ||
open Verso.Code.Highlighted.WebAssets | ||
|
||
open Licenses | ||
|
||
class CanHighlightCode (α : Type) where | ||
addDependencies : α → α | ||
|
||
/-- | ||
Add the necessary frontend dependencies for showing Verso-highlighted Lean code | ||
-/ | ||
def withHighlighting [CanHighlightCode α] (blockOrInline : α) : α := | ||
CanHighlightCode.addDependencies blockOrInline | ||
|
||
instance : CanHighlightCode BlockDescr where | ||
addDependencies b := | ||
{b with | ||
extraCss := highlightingStyle :: b.extraCss | ||
extraJs := highlightingJs :: b.extraJs | ||
extraJsFiles := ("popper.js", popper) :: ("tippy.js", tippy) :: b.extraJsFiles | ||
extraCssFiles := ("tippy-border.css", tippy.border.css) :: b.extraCssFiles | ||
licenseInfo := b.licenseInfo |>.insert tippy.js |>.insert popper.js | ||
} | ||
|
||
instance : CanHighlightCode InlineDescr where | ||
addDependencies i := | ||
{i with | ||
extraCss := highlightingStyle :: i.extraCss | ||
extraJs := highlightingJs :: i.extraJs | ||
extraJsFiles := ("popper.js", popper) :: ("tippy.js", tippy) :: i.extraJsFiles | ||
extraCssFiles := ("tippy-border.css", tippy.border.css) :: i.extraCssFiles | ||
licenseInfo := i.licenseInfo |>.insert tippy.js |>.insert popper.js | ||
} |
Oops, something went wrong.