Closed RomainTT closed 7 years ago
Hello! Which version of Secreatary are you using?
Not sure if related - but markdown filter has been working for me with the following
{{ description|markdown|safe }}
Might need to mess with styles in the Libre template to get it working - some things like ordered lists, or code snippets etc can be difficult as they are not simple character styles- works pretty well with bold, italics and headers.
Hello, thank you for your answers.
I am using version 0.2.11 (the one I got through pip install
)
When I try {{ description|markdown|safe }}
, there is no insertion at all, even if the original text (in description
) is just a simple text like "Hello world". (I looked at the XML code to confirm this).
Weird thing, maybe not in correlation : I have to put white spaces around the |
character, or it does not work.
After doing some tests I believe your issue is that you are not using the input fields
required by Secretary to input template instructions. See https://github.com/christopher-ramirez/secretary#printing-variables
Please confirm that this resolves your issue so I can close this one.
@harmon25 thanks for you comments. I will give a check into the markdown filter in the next version of the library. I'm planning to change the implementation details of filters that came within Secretary.
I am using the input fields
required by Secretary to input template instructions (I double checked that).
Sorry but it is not the cause... Does the LibreOffice version impact the behaviour ? Mine is 4.2.8.2
I don't think LibreOffice have anything to do with this issue. What problems you have when removing the spaces around filter instruction char |
?
Ok it seems to work but with these conditions :
|
|safe
at the end.Sorry I did not try this specific case before...
Thank you for your help, I must say that you did a great job with this library ! It is perfect for my work.
Sorry but it seems that I have another issue with this markdown filter...
Lists are not converted. When I directly use markdown2.markdown
on my original text (to test it), the output does have <ul>
and <li>
tags, but the output in the Libre file is just empty.
Glad to hear that! I'm reviewing what you and @harmon25 reported about the markdown lists.
Thanks for reporting this to me.
Hi Christopher,
I would like to submit you a little improvement but I'm not used to github contributions (I don't know how to suggest a commit ???).
I just would like to add a jinja2 extension (the with
extension) when you create the Jinja Environment.
Code is:
self.environment = Environment(undefined=UndefinedSilently, autoescape=True, extensions=['jinja2.ext.with_'])
It has no impact on the lib, it only allows to use the with
keyword which is very useful. (I need this extension for my project to work)
edit: Just noticed that I should not have posted this in this issue.... Sorry I'm definitely not used to Github contributions...
@RomainTT I prefer that to be manually added by the user. e.g.:
from secretary import Renderer
engine = Renderer()
engine.environment.add_extension(...)
I believe that having a clean environment is a better approach for a generic use.
I did not understand I could do this way. I agree with you. Thank you again.
Hey!
I've just applied a hotfix to markdown filter. You can now find it in the 0.2.12 version just uploaded. Please try it. Hope it resolves the issues found with lists.
Thanks for your support.
Yes it works perfectly ! Thank you very much !
Hello, I am trying to use the markdown filter but it does not work well.
Writing this field in a document :
{{ description | markdown }}
I have this result in the generated .odt file :
<text:p text:style-name="Standard">This is a <text:span text:style-name="markdown_bold">text</text:span></text:p>
When I save the file into .fodt to see XML code, I get this :
<text:p text:style-name="P17"><text:p text:style-name="Standard">This is a <text:span text:style-name="markdown_bold">text</text:span></text:p><text:line-break/></text:p>
Seems that the XML code is not properly inserted into the .odt code.
edit: If I add
| safe }}
to the field, it does not insert anything at all.