kliu57 / go-go-web Goto Github PK
View Code? Open in Web Editor NEWCommand-line tool that converts TIL posts into .html files.
License: MIT License
Command-line tool that converts TIL posts into .html files.
License: MIT License
If the file is a markdown file:
If the file is a text file:
If a title/heading has been identified:
<title>...</title>
and add an <h1>...</h1>
to the top of the <body>
*text*
and _text_
are not being parsed to <em>text</em>
add delete and recreate til/ folder on each run?
Update go-go-web examples documentation site with examples of all features that are not presently displayed
pip install python-frontmatter
_version.py
Create a unit test for the following function src/convert.py
def markdown_to_html(path, output_folder, css_url)
This function takes an input md file path and writes to a new .html file
Please create a temporary input file to test the following:
# Replace *italic* and _italic_ with <em>italic</em>
# Replace **bold** and __bold__ with <strong>bold</strong>
# Replace `text` with <code>text</code>
# Replace multi-line code blocks that are inside ```...``` with <pre>...</pre>
parameters of markdown_to_html
:
path
: the path to an input file (ex: "examples/test3.md")
(create a temporary file using: helpers.new_file(tmpdir, "your_file_name.md", pytest.your_global_var)
)
set pytest.your_global_var
in conftest.py
pytest_configure()
to a long string which represents the markdown content of the input file (see other global variables in conftest.py
to get an idea)
output_folder
: the path for the output file (ex: til) (you can use a temporary directory, just put tmpdir
)
css_url
: no need to test this param, just use empty string
Create the unit test in tests/convert_test.py
To name the unit test, use def test_markdown_to_html(tmpdir, helpers):
How to compare the output of markdown_to_html after running the function
:
# Compare actual output file contents to expected
output_path = tmpdir.join('your_file_name.html')
assert helpers.file_contents(output_path) == pytest.your_html_global_var
you must set pytest.your_html_global_var
in conftest.py
pytest_configure()
to a long string which represents the expected html content.
Please run pylint and autopep8 prior to submitting the pull request. (Instructions in contributing.md)
@WangGithub0 Hi Yumei can I ask you to implement this fix since you added the Markdown feature?
Feedback from professor:
I would probably break the md and html aspects of this function into two smaller functions, and name this convert_txt
or something:
def convert_to_html(text, type):
If type == ‘markdown':
return markdown_to_html(text)
else
return text_to_html(text)
That’s just pseudo code, but you get the idea.
Find front matter parser:
update the test3.md test file to include front matter
test the following front matter:
author in front matter will be parsed into html such as <meta name="author" content="John Doe">
If user specified a custom output location (via command line or via config file), do not delete/create the default til folder.
When converting .md files to .html, add support for inline code blocks. In Markdown, enclosing text in a single backtick causes the text to HTML to get rendered as <code>...text...</code>
, and using 3-backticks creates fenced code block to get rendered in between <pre>
tags.
Please add Installation, Usage, License, Features in the README
Update the get_html_before_body()
method which is used to generate html that appears before the body:
Update the calls of get_html_before_body()
to reflect new params
{}
as the paramadd the process to parse italic and bold for Markdown file.
When converting .md files to .html, add support for a horizontal rule in Markdown. The Markdown ---
should get converted to an <hr>
tag.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.