Resolve #3827 Consider \markdownInput as input

This commit is contained in:
James-Yu 2023-04-17 11:10:58 +08:00
parent 5542d22185
commit 8d65fd9d4f
6 changed files with 22 additions and 4 deletions

View File

@ -254,7 +254,7 @@ export class Completer implements vscode.CompletionItemProvider {
provider = this.documentClass
break
case 'input':
reg = /\\(input|include|subfile|subfileinclude|includegraphics|includesvg|lstinputlisting|verbatiminput|loadglsentries)\*?(?:\[[^[\]]*\])*{([^}]*)$/
reg = /\\(input|include|subfile|subfileinclude|includegraphics|includesvg|lstinputlisting|verbatiminput|loadglsentries|markdownInput)\*?(?:\[[^[\]]*\])*{([^}]*)$/
provider = this.input
break
case 'includeonly':

View File

@ -275,8 +275,7 @@ async function parseLaTeXSubFileCommand(node: latexParser.Command, config: LaTeX
let candidate: string | undefined
// \input{sub.tex}
if (['input', 'InputIfFileExists', 'include', 'SweaveInput',
'subfile', 'loadglsentries'].includes(node.name.replace(/\*$/, ''))
if (['input', 'InputIfFileExists', 'include', 'SweaveInput', 'subfile', 'loadglsentries', 'markdownInput'].includes(node.name.replace(/\*$/, ''))
&& cmdArgs.length > 0) {
candidate = resolveFile(
[path.dirname(file),

View File

@ -16,7 +16,7 @@ interface MatchPath {
}
export class InputFileRegExp {
private readonly inputReg = /\\(?:input|InputIfFileExists|include|SweaveInput|subfile|loadglsentries|(?:(?:sub)?(?:import|inputfrom|includefrom)\*?{([^}]*)}))(?:\[[^[\]{}]*\])?{([^}]*)}/g
private readonly inputReg = /\\(?:input|InputIfFileExists|include|SweaveInput|subfile|loadglsentries|markdownInput|(?:(?:sub)?(?:import|inputfrom|includefrom)\*?{([^}]*)}))(?:\[[^[\]{}]*\])?{([^}]*)}/g
private readonly childReg = /<<(?:[^,]*,)*\s*child='([^']*)'\s*(?:,[^,]*)*>>=/g
/**

View File

@ -0,0 +1,5 @@
\documentclass{article}
\usepackage{markdown}
\begin{document}
\markdownInput{sub.md}
\end{document}

View File

@ -0,0 +1,5 @@
## Sample
sample
### Sample
sample

View File

@ -108,4 +108,13 @@ suite('Auto-build test suite', () => {
const { type } = await test.auto(fixture, 'sub/s.tex', false, true)
assert.strictEqual(type, 'onSave')
})
test.run('auto build with markdownInput', async (fixture: string) => {
await test.load(fixture, [
{src: 'build/markdown_base.tex', dst: 'main.tex'},
{src: 'build/markdown_sub.md', dst: 'sub.md'}
])
const { type } = await test.auto(fixture, 'sub.md')
assert.strictEqual(type, 'onChange')
})
})