如何在 vscode 笔记本中获取 Julia 函数的文档?

问题描述 投票:0回答:1

我想在 vscode 上的笔记本(.ipynb 文件)中获取 Julia 函数的文档:

?cc

给出:

ParseError:
# Error @ e:\Julia Forks\TimeSeries-Cepstral-Clustering\example\example.ipynb:1:1
? cc
╙ ── not a unary operator

Stacktrace:
 [1] top-level scope
   @ e:\Julia Forks\TimeSeries-Cepstral-Clustering\example\example.ipynb:1

或者:

Docs.doc(cc)

给出:

ParseError: KaTeX parse error: No such environment: verbatim at position 7: \begin{̲v̲e̲r̲b̲a̲t̲i̲m̲}̲ cc(series::Abs…

Calculate the cepstral coefficients of the AR(p) process for each asset in the series.

\section{Arguments}\begin{itemize} \item \texttt{series::AbstractMatrix}: a matrix of time series observations, with each row representing an asset and each column representing a time step.

\item \texttt{p::Int}: the order of the AR(p) process.

\item \texttt{n::Int}: the number of cepstral coefficients to calculate.

\end{itemize} \section{Returns}\begin{itemize} \item \texttt{cc_vec::AbstractMatrix}: a matrix of cepstral coefficients, with each row representing an asset and each column representing a cepstral coefficient.

\end{itemize}

不干净!还有更好的办法吗?

visual-studio-code jupyter-notebook julia
1个回答
0
投票

解决方法如下。

定义宏:

macro h(x)
    quote
        display("text/markdown", @doc $x)
    end    
end

现在您可以执行

@h myfun
,例如:

© www.soinside.com 2019 - 2024. All rights reserved.