Using files with .markdown extension

450 views
Skip to first unread message

mandaris

unread,
Sep 2, 2011, 1:17:03 PM9/2/11
to Hyde
Is there a pre-processor that would allow me to take a file (ex.
some_blog_entry.markdown) and then turn that into a page? Jykell has
something like it and I wanted to know if it's already here or someone
would have to code it.


Harry Lachenmayer

unread,
Sep 2, 2011, 2:43:15 PM9/2/11
to hyde...@googlegroups.com
Hi, have a look at: https://github.com/lepture/hyde.ext
There's a plugin there called suffix.py.
(I haven't actually used it myself, I only saw it in the mailing list recently!)

harry



--
You received this message because you are subscribed to the Google Groups "Hyde" group.
To post to this group, send email to hyde...@googlegroups.com.
To unsubscribe from this group, send email to hyde-dev+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hyde-dev?hl=en.


Mandaris

unread,
Sep 26, 2011, 6:01:08 PM9/26/11
to hyde...@googlegroups.com
How do you add an extension to a default installation?

lepture

unread,
Sep 27, 2011, 2:01:12 AM9/27/11
to hyde...@googlegroups.com

Configuration example
---------------------
#yaml
suffix:
-
target_extension:
- markdown
- md
output_extension: html
-
target_extension:
- rst
- restructed
output_extension: html

Mandaris Moore

unread,
Sep 27, 2011, 8:03:09 AM9/27/11
to hyde...@googlegroups.com
Ok, so the way I'm understanding this is that there isn't a file I need to add. Just change the something in the yaml of the configuration file.
Correct?

Mandaris Moore
Email: Mandari...@gmail.com

--
You received this message because you are subscribed to the Google Groups "Hyde" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hyde-dev/-/wjAAruy-P8kJ.

lepture

unread,
Sep 27, 2011, 9:20:42 AM9/27/11
to hyde...@googlegroups.com
yes.

but you need install this plugin. or put this script file in the PYTHON PATH. 

you need also add this plugin in your "site.yaml"

Mandaris

unread,
Sep 27, 2011, 8:13:15 PM9/27/11
to hyde...@googlegroups.com
Ok, I got it "working" so that my .markdown files are turned into html but they don't show up properly in list for post even though they are formatted properly.

So my two last problem:
1. The sorter doesn't seem to recognize the html files
2. How would I do excerpts from markdown files without putting the {%mark excerpt %} (this one isn't as important)

Here is my site.yaml 

mode: development
media_root: media
media_url: /media # will use relative path, prepend "/" for absolute path
base_url: / # The base url for autogenerated links.
template: hyde.ext.templates.jinja.Jinja2Template
plugins:
    - hyde.ext.plugins.meta.MetaPlugin
    - hyde.ext.plugins.auto_extend.AutoExtendPlugin
    - hyde.ext.plugins.syntext.SyntextPlugin
    - hyde.ext.plugins.sorter.SorterPlugin
    - hyde.ext.plugins.tagger.TaggerPlugin
    - hyde.ext.plugins.textlinks.TextlinksPlugin
    - hyde.ext.plugins.suffix.SuffixPlugin
context:
    data:
        author:
            name: Mandaris Moore
            url: "http://www.quotidianquest.com"
        layout:
            name: Hyde Starter Kit
        project:
            name: Hyde
            url: "http://hyde.github.com"
            install: "http://hyde.github.com/install.html"
        menu:
          - title: Home
            url: /index.html
          - title: What next
            url: /what-next.html
          - title: Blog
            url: /blog
          - title: Projects
            url: /projects
          - title: Links
            url: /links.html
          - title: About
            url: /about.html
meta:
    nodemeta: meta.yaml
    created: !!timestamp 2010-01-01 00:00:00
    author: Mandaris Moore
suffix:
     -
        target_extension:
            - markdown
            - md
        output_extension: html
sorter:
    time:
        attr:
            - meta.created
        reverse: true
        filters:
            source.kind: html
            meta.listable: true
tagger:
    sorter: time
    archives:
        blog:
            source: blog
            target: blog/tags
            template: tagged_entries.j2
            archive_extension: html


--
You received this message because you are subscribed to the Google Groups "Hyde" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hyde-dev/-/NUv7VycOjvgJ.

Mandaris

unread,
Sep 27, 2011, 8:16:32 PM9/27/11
to hyde...@googlegroups.com

lepture

unread,
Sep 27, 2011, 9:37:33 PM9/27/11
to hyde...@googlegroups.com
sorter:
    time:
        attr:
            - meta.created
        reverse: true
        filters:
            source.kind: html
            meta.listable: true


source.kind

Mandaris

unread,
Sep 27, 2011, 11:56:39 PM9/27/11
to hyde...@googlegroups.com
For some reason removing "source.kind" causes a template not found error..

 20:46:02 hyde.engine Error occurred when processing template: [/Users/mando/Dropbox/Hyde_Quest/content/index.html]
Traceback (most recent call last):
  File "/usr/local/bin/hyde", line 8, in <module>
    load_entry_point('hyde==0.8.3', 'console_scripts', 'hyde')()
  File "/Library/Python/2.6/site-packages/hyde/main.py", line 10, in main
    Engine().run()
  File "/Library/Python/2.6/site-packages/hyde/engine.py", line 38, in run
    super(Engine, self).run(args)
  File "/Library/Python/2.6/site-packages/commando.py", line 198, in run
    args.run(self, args)
  File "/Library/Python/2.6/site-packages/hyde/engine.py", line 115, in gen
    gen.generate_all(incremental=incremental)
  File "/Library/Python/2.6/site-packages/hyde/generator.py", line 204, in generate_all
    self.__generate_node__(self.site.content, incremental)
  File "/Library/Python/2.6/site-packages/hyde/generator.py", line 302, in __generate_node__
    self.__generate_resource__(resource, incremental)
  File "/Library/Python/2.6/site-packages/hyde/generator.py", line 322, in __generate_resource__
    context)
  File "/Library/Python/2.6/site-packages/hyde/ext/templates/jinja.py", line 692, in render_resource
    out = template.render(context)
  File "/Library/Python/2.6/site-packages/jinja2/environment.py", line 894, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/mando/Dropbox/Hyde_Quest/content/index.html", line 4, in top-level template code
    {% extends "core.j2" %}
  File "/Users/mando/Dropbox/Hyde_Quest/layout/core.j2", line 29, in top-level template code
    {% block content %}{% endblock %}
  File "/Users/mando/Dropbox/Hyde_Quest/content/index.html", line 17, in block "content"
    {% refer to latest.url as article %}
  File "/Library/Python/2.6/site-packages/hyde/ext/templates/jinja.py", line 456, in _assign_reference
    out = caller()
  File "/Users/mando/Dropbox/Hyde_Quest/content/index.html", line 17, in template
    {% refer to latest.url as article %}
  File "/Library/Python/2.6/site-packages/hyde/ext/templates/jinja.py", line 495, in get_source
    environment, template)
  File "/Library/Python/2.6/site-packages/jinja2/loaders.py", line 180, in get_source
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: blog/2011/09/testing_markdown.html


I tried the following:
source.kind: html, markdown
source.kind: html markdown

And this just made the sorter not show anything. 

What is going on? How can I learn about this to help fix it and make it better?

--
You received this message because you are subscribed to the Google Groups "Hyde" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hyde-dev/-/BBEIOkMPX2UJ.

lepture

unread,
Sep 28, 2011, 5:43:28 AM9/28/11
to hyde...@googlegroups.com
1. sorter plugin does not accept list, so you can use only one extension, which means you cannot use .markdown and .html at the same time.
2. if you transfered all .html to .markdown, you will meet another problem:

in your template, you cannot use  {% refer to res.url as article -%} , because res.url will find a source with ".html" , instead, you can use {% refer to res.relative_path as article -%} as a solution.

I think it's too complex for you , if you didn't read the code.

I suggest you use .html as the extension. but if you really want a solution, I can update my fork of Hyde to meet your demands. But I will not update my fork of Hyde in the future, for I am not using Hyde right now.

Danny Staple

unread,
Oct 28, 2013, 1:19:13 PM10/28/13
to hyde...@googlegroups.com
Where is this code? I can not find it on github any more. I am hoping not to need to write your plugin again...

Jared Sampson

unread,
Oct 28, 2013, 3:09:59 PM10/28/13
to hyde-dev
Hi Danny - 

This came up a number of months ago as well.  See this thread (https://groups.google.com/d/topic/hyde-dev/EtJ7bRUQEBA/discussion) which may be helpful.

Cheers,
Jared


--
You received this message because you are subscribed to the Google Groups "Hyde" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hyde-dev+u...@googlegroups.com.

To post to this group, send email to hyde...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages