Skip to content

Change \n to <br> in auto generated parameter documentation - #385

Open
MaceKuailv wants to merge 9 commits into
OceanBioME:mainfrom
MaceKuailv:minor-doc-fix
Open

Change \n to <br> in auto generated parameter documentation#385
MaceKuailv wants to merge 9 commits into
OceanBioME:mainfrom
MaceKuailv:minor-doc-fix

Conversation

@MaceKuailv

Copy link
Copy Markdown

I was clicking around in the documentation and rediscovered issue #239, see also https://oceanbiome.github.io/OceanBioME.jl/stable/generated/CarbonChemistry_parameters/. I realized that it is about the different types of returns "\r\n" and there is a very simple fix. The resulting markdown file looks OK to me:

CarbonChemistry default parameters

Name Value
ionic_strength Ionic strength
Is = 19.924 S/(1000.0 + -1.005 S)
solubility Solubility constant
ln(k₀/k°) = -60.2409 + 9345.17 / T + 23.3585 (log(T) - log(100)) + 0.0 T² + (0.023517 + -0.00023656 T + 4.7036e-7 T²)S
carbonic_acid (K1 = First carbon dioxide dissociation constant
log₁₀(k₁/k°) = 61.2172 + -3633.86 / T + -9.6777 log(T) + 0.011555 S + -0.0001152 S², K2 = Second carbon dioxide dissociation constant
log₁₀(k₂/k°) = -25.929 + -471.78 / T + 3.16967 log(T) + 0.01781 S + -0.0001122 S²)
boric_acid Boric acid dissociation constant
ln(kᵇ/k°) = 148.0248 + (-8966.9 + -2890.53 √S + -77.942 S + 1.728 √S³ + -0.0996 S²) / T
+ 137.1942 * √S
+ 1.62142 * S
+ (-24.4344 + -25.085 √S + -0.2474 S ) * log(T)
+ 0.053105 * √S * T
water Water dissociation constant
ln(kʷ/k°) = 148.9652
+ -13847.26 / T
+ -23.6521 log(T)
+ (-5.977 + 118.67 / T + 1.0495 log(T)) √S
+ -0.01615 * S
sulfate Bisulfate dissociation constant
ln(kˢ/k°) = 141.328
+ -4276.1 / T
+ -23.093 log(T)
+ (324.57 + -13856.0 / T + -47.986 log(T)) √Is
+ (-771.54 + 35474.0 / T + 114.723 log(T)) Is
+ -2698.0 √Is³ / T
+ 1776.0 Is² / T
+ log(1 + -0.001005 S)
fluoride Hydrogen fluoride dissociation constant
ln(kᶠ/k°) = -9.68
+ 874.0 / T
+ 0.111 √S
+ log(1 + 0.0 S)
+ log(1 + 0.0 S / Kˢ)
phosphoric_acid (KP1 = Phosphate dissociation constant
ln(kᵖⁿ/k°) = 115.525
+ -4576.752 / T
+ -18.453 log(T)
+ (0.69171 + -106.736 / T) √S
+ (-0.01844 + -0.65643 / T) S, KP2 = Phosphate dissociation constant
ln(kᵖⁿ/k°) = 172.0883
+ -8814.715 / T
+ -27.927 log(T)
+ (1.3566 + -160.34 / T) √S
+ (-0.05778 + 0.37335 / T) S, KP3 = Phosphate dissociation constant
ln(kᵖⁿ/k°) = -18.141
+ -3070.75 / T
+ 0.0 log(T)
+ (2.81197 + 17.27039 / T) √S
+ (-0.09984 + -44.99486 / T) S)
silicic_acid Silicic acid constant
ln(kˢⁱ/k°) = 117.385
+ -8904.2 / T
+ -19.334 log(T)
+ (3.5913 + -458.79 / T) √Is
+ (-1.5998 + 188.74 / T) Is
+ (0.07871 + -12.1652 / T) Is²
+ log(1 + -0.001005 S)
calcite_solubility Calcite solubility
log₁₀(kₛₚ) = -171.9065 + -0.077993 T + 2839.319 / T + 71.595 log(T)
log₁₀(kₛₚˢ) = log₁₀(kₛₚ) + (-0.77712 + 0.0028426 T + 178.34 / T) √S
+ -0.07711 S + 0.0041249 √S³
density_function teos10_polynomial_approximation
first_virial_coefficient OceanBioME.Models.CarbonChemistryModel.PolynomialVirialCoefficientForCarbonDioxide{Float64}(-1636.75, 12.0408, -0.032795700000000004, 3.16528e-5)
cross_virial_coefficient OceanBioME.Models.CarbonChemistryModel.CrossVirialCoefficientForCarbonDioxide{Float64}(57.7, -0.118)
solver OceanBioME.DampedNewtonRaphsonSolver{Float64, Int64, @NamedTuple{lower::Float64, upper::Nothing}}(100, 1.0e-20, 0.5, 0.5, 0.0009765625, (lower = 0.0, upper = nothing))

Although I am still having a little bit difficulty with running docs/make.jl to create the documentation, I am relatively confident that this should solve the issue.

@MaceKuailv

Copy link
Copy Markdown
Author

This PR should only affect documentation, the failed tests look similar to the other failed test in other PRs.

@jagoosw

jagoosw commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Thank you for this thats really helpful. It seems like its now not rendering the new lines at all, maybe the br needs to be escaped some way? https://oceanbiome.github.io/OceanBioME.jl/previews/PR385/generated/CarbonChemistry_parameters/

Comment thread docs/display_parameters.jl Outdated
value_width = maximum((length("$value") for value in values))
# sanitize a value so it stays inside a single markdown table row
clean(v) = let s = "$v"
s = replace(s, r"\r?\n\s*" => "<br>") # newlines -> HTML break (drop indent)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this still needs to be \n but the "|" escaping is what atually needed fixing?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think that removing \n is needed. As you can see from the screen shot,
image
The Is = ....that is after an \n is in the second line.

Perhaps we just need to change <br> to something else that the documentation can recognize. Sorry, I should have tested this on my side with the documentation. Unfortunately, I still have some difficulties with generating the documentation on my side, and won’t have time to work on this for a couple of days. If you know what this error is, it would be quite helpful.

ERROR: LoadError: `makedocs` encountered an error [:example_block] -- terminating build before rendering.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:44
  [2] runner(::Type{Documenter.Builder.RenderDocument}, doc::Documenter.Document)
    @ Documenter ~/.julia/packages/Documenter/AXNMp/src/builder_pipeline.jl:259
  [3] dispatch(::Type{Documenter.Builder.DocumentPipeline}, x::Documenter.Document)
    @ Documenter.Selectors ~/.julia/packages/Documenter/AXNMp/src/utilities/Selectors.jl:170
  [4] #95
    @ ~/.julia/packages/Documenter/AXNMp/src/makedocs.jl:283 [inlined]
  [5] withenv(::Documenter.var"#95#96"{Documenter.Document}, ::Pair{String, Nothing}, ::Vararg{Pair{String, Nothing}})
    @ Base ./env.jl:265
  [6] #93
    @ ~/.julia/packages/Documenter/AXNMp/src/makedocs.jl:282 [inlined]
  [7] cd(f::Documenter.var"#93#94"{Documenter.Document}, dir::String)
    @ Base.Filesystem ./file.jl:112
  [8] makedocs(; debug::Bool, format::Documenter.HTMLWriter.HTML, kwargs::@Kwargs{sitename::String, authors::String, pages::Vector{Pair{String, Any}}, modules::Vector{Module}, plugins::Vector{CitationBibliography}, doctest::Bool, clean::Bool, checkdocs::Symbol})
    @ Documenter ~/.julia/packages/Documenter/AXNMp/src/makedocs.jl:281
  [9] top-level scope
    @ ~/Documents/pkg_dvlp/OceanBioME.jl/docs/make.jl:137
 [10] include(mod::Module, _path::String)
    @ Base ./Base.jl:306
 [11] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:317
 [12] _start()
    @ Base ./client.jl:550
in expression starting at /Users/kuailv/Documents/pkg_dvlp/OceanBioME.jl/docs/make.jl:137

If not, I will circle back to this in a couple of days.

@MaceKuailv

Copy link
Copy Markdown
Author

@jagoosw I am happy to report back that the link looks OK now.

I have also added a short script to run the examples manually, and I have added an instruction for other contributors. I hope that is useful.

I have removed two duplicate entries of bibliography. Otherwise, the CI process will fail. It was not failing after my first commit, so must be a recent update. I see that you are wrestling with the CI process, this will also help you resolve a very small part of it. Good luck with the rest! 🍀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants