how to configure sphinx to use local mathjax - python-sphinx

I'm having some trouble getting Sphinx to build pages with a local mathjax library. In the documentation here, it says just to add the following mathjax_path = "MathJax-2.7.4/MathJax.js" to conf.py, but after building the files, I still get <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
Is there something else I need to do, besides run make html to get the configuration to load?
I just added the mathjax_path = "MathJax-2.7.4/MathJax.js" to the end of my conf.py file.

I figured out that Sphinx doesn't rebuild your files unless your .rst source files changed. Because the configuration file doesn't touch the .rst files, it won't cause a rebuild. I ended up just removing all the files from the build directory and letting it recreate all the files.

Related

Adding _includes and _layouts files to Jekyll directory

I'm new to Ruby and Jekyll, and I've been following this tutorial on how to create a static-site. I've reached the part where we're supposed to edit files inside the _includes and _layouts folders, but those folders don't appear in my directory. There is however a _site folder with an index.html file inside it, and it looks like that's what's showing when I run the website with 'jekyll serve'. Am I supposed to add these folders and files in myself, or should I edit _site/about/index.html to match what the tutorial has?
Here's a picture of what my current folder structure looks like:
Yes, you should add those folders and files yourself. Copy them from the theme repo and skip anyone you don't want to customize / override. The default theme config created by command jekyll new is https://github.com/jekyll/minima
The _site folder is being generated on the fly, it reflects the result of the customization.

DBT docs generate - How to give the specific branding to the documentation website

How to replace the DBT logo with some other image in the website header, generated by dbt docs generate command.
The documentation consists of an index.html file, which loads data from the artifact files (source).
If you edit the index.html file you will be able to customise it as you wish. Note that each time you run dbt docs generate the file will be re-copied into your target folder, so you’ll need some mechanism for either copying the artifacts to wherever your new index.html` is located or overwriting the file with your customised version.
If you change the file in the source folder, I believe the index.html file is copied from the dbt installation folder to the target folder everytime you run dbt docs generate. You can customize the index.html file from that directory and then you don't have to worry about making any changes when you run dbt docs generate.
This is what I'd do:
Find index.html file in the dbt installation directory add the line
<link rel='stylesheet' href='/styles.css' />
in the <head> tag. This way, you only have to make this change again when you update dbt
Add a styles.css file in your target folder and then target the class of the dbt logo. If you change the background color of the logo, you should be fine and you will not have to re-copy every time you run dbt docs generate.
.logo {
background-image: url(<<path or url to your image>>);
background-color: transparent;
}
You can adjust other properties like background-repeat, background-position, background-size, background-color according to your preferences.
Wanted to expand on #Kay answer a bit as it helped me tremendously.
To find the dbt installation folder on Windows, you need to go into your venv folder within your project and navigate down to the dbt/include folder. This may be different for different projects/OS, so here is my path to help shed light on where this may be:
venv --> Lib --> site_packages --> dbt --> include --> index.html
Once you have located the file, follow the steps in #Kay answer. The only modification that I made is to add in a corresponding file path in the HTML added to the index.html file
<link rel='stylesheet' href='**..dbt_project_path**/styles.css' />
Next, in your dbt project, go and add that specific folder to your root dbt project directory. From there, add in your .css file. By aligning the index.html file path to the file path created in your dbt project, you will always reference the .css (or any other modifications you have) when running the dbt docs generate command.

Minify JSON (or XML) in XCode build phase

I'm building an iOS app that frequently loads JSON configuration files at runtime.
However, the files are very generous with comments and indenting.
How can I tell XCode to copy minified versions of the files to the bundle during build?
You just need to add a build phase to your target. Here is an example, my build script that converts a multimarkdown file to an HTML file.
# Create the HTML file from the Markdown File
/usr/local/bin/multimarkdown --process-html --output="${SCRIPT_OUTPUT_FILE_0}" --to=html "${SCRIPT_INPUT_FILE_0}"
# Publish the Help Text and Image to Dropbox
if [ -d ~/Dropbox/Public/DCWS-Help-Text ]; then
rsync -t "${SRCROOT}/DC Wire Sizer/en.lproj/"* ~/Dropbox/Public/DCWS-Help-Text/
fi
I create the file in the source directory but added it to my git ignore file. It is a build product and not in source control, but you need to make sure it is in your project and part of the target, so it gets copied into the bundle. Also make sure your build script runs before your copy bundle phase.

Where is the file that generates the config.rb file?

When I create a new Compass project, it generates several directories and files and provides the config.rb file. Rather than changing the config file every time I start a project, can I set this up in a existing default file? and where is it?
Take a look at this pull request, it might help: https://github.com/kahlil/grunt-compass/issues/13

separate sphinx build and source directories for version control

I have a working directory containing my project and it is in a version control system. I'd like to create a doc directory inside my project that contains only restructured text files for sphinx.
That is, I don't want sphinx to build html files inside my project, but put them outside so they don't get put into version control.
So if you question is 'How can I build documentation outside of the source tree', the documentation helps:
sphinx-build -b html sourcedir builddir
Just point builddir to a location outside of your source tree.
Or, depending on your version control system, add the directory you generate your documentation to an 'ignore file' (e.g. .gitignore, .hgignore, ...)

Resources