Skip to content

Commit 71eb61b

Browse files
committed
Make matching against markdown part command more general
1 parent 2f50097 commit 71eb61b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Manual/Meta/Markdown.lean

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Author: Joachim Breitner
66

77
import VersoManual
88
import Manual.Meta.Figure
9-
import Lean.Elab.InfoTree.Types
9+
import Lean.Elab.InfoTree
1010

1111
open Verso Doc Elab
1212
open Verso.Genre Manual
@@ -30,7 +30,12 @@ def Block.noVale.descr : BlockDescr where
3030

3131
@[part_command Lean.Doc.Syntax.codeblock]
3232
def markdown : PartCommand
33-
| `(Lean.Doc.Syntax.codeblock| ``` markdown | $txt ``` ) => do
33+
| `(Lean.Doc.Syntax.codeblock| ``` $markdown:ident $args*| $txt ``` ) => do
34+
let x <- Lean.Elab.realizeGlobalConstNoOverloadWithInfo markdown
35+
if x != (by exact decl_name%) then Elab.throwUnsupportedSyntax
36+
for arg in args do
37+
let h <- MessageData.hint m!"Remove it" #[""] (ref? := arg)
38+
logErrorAt arg m!"No arguments expected{h}"
3439
let some ast := MD4Lean.parse txt.getString
3540
| throwError "Failed to parse body of markdown code block"
3641
let mut currentHeaderLevels : Markdown.HeaderMapping := default

0 commit comments

Comments
 (0)