Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to output a raw string from an FSI evalutation instead of having it wrapped in code blocks #611

Closed
HLWeil opened this issue Sep 25, 2020 · 6 comments · Fixed by #624

Comments

@HLWeil
Copy link
Contributor

HLWeil commented Sep 25, 2020

Hey, is it possible to somehow use a custom fsiEvaluator when running dotnet fsdocs build?

@dsyme
Copy link
Contributor

dsyme commented Sep 28, 2020

Hey, is it possible to somehow use a custom fsiEvaluator when running dotnet fsdocs build?

No. This kind of parameterization sits very awkwardly with a command line tool

What specifically are you looking for ? I never fully understood the use cases for custom evaluators, given the complexity they bring

@HLWeil
Copy link
Contributor Author

HLWeil commented Sep 28, 2020

Thanks for your answer.

I'm looking for embedding Plotly charts like we did here.

@HLWeil
Copy link
Contributor Author

HLWeil commented Sep 28, 2020

Sry my description was very unspecific.
My problem is, that even when I try a workaround like piping the chart into a function which returns a finished html string, this string then gets inserted into <code> and <pre> tags, preventing the chart to be rendered. In our own build script, we used an FSI evaluator which did not create this tag when given a chart. But using the new command line tools seems much more lightweight and easily manageable so we would like to migrate.

I understand that using the custom evaluator with the tools is not doable. So the follow up question would be: Is it possible to prevent the standard evaluator from packing the evaluated result into <pre> tags?

@dsyme
Copy link
Contributor

dsyme commented Sep 28, 2020

OK I see. Yes we can address this somehow

However I'd really appreciate step by step instructions about which charting library etc. Exact step by step please, including actual and expected results

@HLWeil
Copy link
Contributor Author

HLWeil commented Sep 29, 2020

Reproduction

I created a repo for illucidating my problem: https://github.com/HLWeil/FsDocsEvaluatedCharts

The repro steps are described there. The created output/ChartTest.html is the file of interest. In this file three ways to embed a chart are displayed:

  1. Include Chart directly (Using a custom FsiEvaluator; Undoable)

  2. Include Evaluated HTML string (Using an additional function)

  3. HTML String (Include the chart html by hand; Just for showcase purposes)

Desired result

The chart html gets correctly formatted not only in the third, but also in the second case.

Actual result

The chart html does not get formatted correctly but as a code snippet. This is because the standard FsiEvaluator inserts the evaluated result into <code> and <pre> tags.

Possible solution

Maybe it is possible to offer a literate command which does not encapsulate the evaluated result into tags. This could e.g. be called (***include-inline***).

@adz
Copy link

adz commented Oct 10, 2020

FSharpPlus has a plantuml based diagram - it works by generating a diagram from a local text-file. The diagram is encoded into an url that uses www.plantuml.com/plantuml to generate the actual graphic. We currently manually inject this url as a post-processing step:
https://github.com/fsprojects/FSharpPlus/blob/master/docsrc/tools/Program.fs#L160

The call to_url is from Plantuml module:
https://github.com/fsprojects/FSharpPlus/blob/master/docsrc/tools/templates/plantuml.fs#L8

which then replaces {plantUMLDiag} here:
https://github.com/fsprojects/FSharpPlus/blob/master/docsrc/content/abstractions.fsx#L15

producing:
https://fsprojects.github.io/FSharpPlus/abstractions.html

I'm moving it over to use the fsdocs cmd, and am looking for a way to do this. Might be another use case?

@cartermp cartermp changed the title Using Custom FSIEvaluator with the fsdocs tool Ability to output a raw string from an FSI evalutation instead of having it wrapped in code blocks Dec 21, 2020
@cartermp cartermp linked a pull request Dec 21, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants