I would like to add the following line to my conf.py file for Sphinx documentation, which apparently is valid for nbsphinx but isn't working for Sphinx 4.0.2.
rst_epilog = r"""
{% set docname = env.doc2path(env.docname, base=None) %}
.. tip:: this is {{ docname }}
"""
Update
Based upon suggestions made in the comments, I have reviewed this blog entry describing integration of Rst and Jinja in Sphinx and attempted to incorporate this tutorial information about creating a custom extension.
My approach was to follow the tutorial for including directories and modifying conf.py while using the module verbatim from the blog for my extension.
Ultimately, my desired use is still not functioning properly. I can confirm that Sphinx knows of my extension by including typos in the module (which causes make to fail) or by changing the extension to do nothing (i.e. commenting out the last line of the rstjinja function, so the extension does nothing except burn CPU cycles).
Related
I am using Hexo to post my blog online and Hexo requires me to include a YAML Front Matter in my .md file so it can render the title in my online blog.
Manually adding the YAML Front Matter title file is tedious. How can I automatically generate the title according to the name of the .md file?
Like when I create a Managing dependencies.md file, Typora would automatically add the title: Managing dependencies YAML Front Matter as I open it for the first time. Or is there any script that enables me to use only a single shortcut to generate it?
enter image description here
I just started using Docfx and set up some basic conceptual documentation. Now I want to make some adjustments to the theme (company logo, perhaps some font changes, etc.) Minor stuff.
The official documentation only gives a high-level description of how to create a new template. I've never used a templating language before, so I'd like to avoid that for now if possible.
My question is: how can I make small adjustments to the default theme, like some CSS changes and perhaps adding external resources (like font awesome)?
Do I have to create an entire template (or a part of it) or can I include a CSS file somehow? The documentation mentions a theme option but so far I've found no examples or existing themes to learn from.
A mere link to a project that uses a custom theme or template would already be very helpful. The docfx repo has a docfx.website.themes folder and the default template is also in there I believe, but I couldn't really figure out which files I would have to provide to roll my own.
Export template:
Run docfx template export default, then you'll see default template in _exported_templates\default
Change themes in default template, e.g:
Adding external resource: modify styles\head.tmpl.partial
CSS change: modify styles\docfx.css or styles\main.css
Use customized template:
Run docfx -t _exported_templates\default, which will use your customized template!
NOTE: It is possible that DocFX updates its embedded templates when releasing new version. So please make sure to re-export the template if you overwrite or dependent on that template in your custom template.
I have a real noob Magento question. I'm helping a friend change the template their store is using but they are worried about losing the functionality of some of their extensions such as ajaxsearch. They don't know if it's actually an extension or part of the template. I can't seem to figure out if some of the extensions are built into the theme or if they are completely separate extensions. Is there an easy way to tell?
To give an example the ajaxsearch JS file's path seems to in the template path e.g http://www.example.com/skin/frontend/default/templatename/js/ajaxsearch.js
and if I go to system > configuration I can see it listed in the sidebar under Templates-Master (which I think is a brand name). In this case is this an extension and is this how file paths work for extensions? The fact that skin is in the file path is throwing me off.
Thanks!
Fast way:
Each Magento extension provided as archive (.tgz). Unpack it to some folder outside Magento and check have it next path or not:
unpacked_folder/skin/frontend/default/templatename/js/ajaxsearch.js
(another trick is look in the first lines of ajaxsearch.js file, authors often write extension or theme names in it).
Long way:
Find where is this file included on page. Search for 'ajaxsearch.js' in xml files placed in app/design/frontend/default/templatename/layout/
if not found, try to search in app/design/frontend/default/default/layout/ etc.
For example you find it in somefile.xml
Try to find which extension include this file. For doing this search 'somefile.xml' in config.xml files in local and community pools:
app/code/local/some/extension1/etc/config.xml
app/code/local/some/extension2/etc/config.xml
app/code/community/some/extensionN/etc/config.xml
etc
If you found it in ...some/extensionX/etc/config.xml - this mean what ajaxsearch.js belongs to some_extensionX extension. If not found - it belongs to theme.
I know I can change the default layout directory by specifying the new directory in _config.yaml like this:
layouts: "templates"
Doing the same for the includes directory doesn't seem to be working. I cannot find any documentation for it either on the jekyll website. Here is what i tried
includes: "partials"
Its not working though. It would be great if anyone could help out with this. Thanks!
No way, it's hard coded in Jekyll::Tags::IncludeTag.
You can try to override the class or make a feature request to the Jekyll team if you want to be able to change include directory in the future.
Base on this doc, you can also choose to include file fragments relative to the current file:
{% include_relative somedir/footer.html %}
How to generate not *.html files with Jekyll but files with another extension? I would like to patch it with rb plugin. Is it possible?
I tried this (googled this), but it doesn't work:
module Jekyll
# Extensions to the Jekyll Page class.
class Page
def output_ext(ext)
".myext"
end
end
end
If you want an output to _sites/ with your extension “from the box”, you can use only pages files — they're not using the permalink from the config, so those files would have the same extension you gave to them.
So, the smallest set is a file page.my-ext at the root of your project, having a YAML front matter (could be empty) like this:
---
---
Foo
Such file would be visible to the Jekyll, you could use any liquid markup inside, or use any layout for it, and then this file would be saved to the _sites/ with the same name it was before.
You can't use such file in /_posts/, 'cause when there is a permalink set, Jekyll saves files only as .html.
Custom plugin with converter works for me, but also only for simple pages — posts from /_posts/ are still getting .html, so it seems that it's hardcoded there.
So, the only way right now is to use simple pages instead of posts. And if you'd like to iterate through all such pages as you can do with posts, you should read on how the pages_list module from Jekyll Bootstrap is made — I think it's something like that.
EDITED:
Sollution found here:
http://jekyllrb.com/docs/permalinks/
You can specify the permalinks in the markup post. It will unfortunately not work if specified in _config.yml
According to my tests, if you enter:
permalink: /whatever/filename/with/arbitrary.xtension
in the markup post, your index file will be named "arbitrary.xtension" and placed in the folder:
/whatever/filename/with/
For other applications where the content of the file needs to be consistent to the extension, this plugin might perhaps help you:
https://github.com/fauno/jekyll-pandoc-multiple-formats