Giter Club home page Giter Club logo

notoma's People

Contributors

dependabot-preview[bot] avatar natikgadzhi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

notoma's Issues

Support images in the front matter

If the front matter key (database field) is an attachment, try processing it, and return a path to the attachment on the web server.

The initial implementation will be affected by #25. If we preprocess and copy all images, then the front-matter key will need to return the path to the image on the web server that's generated by the user's blogging engine, this will need to be a setting.

The initial implementation may be limited to just images — it's the most common type of an embedded attachment in the front-matter anyway.

Add integration tests that test common markup on a page

The idea is to have a very simple integration test that would verify that Notoma Convert works as expected.

To make this, I can:

  • Create a simple test structure, like tests/integration/convert/
  • Add a fixture of a Markdown file that I convert with Notoma manually and review it's correctness, we'll use this as reference.
  • Write a simple shell script as a test that would invoke notoma convert, use the key and the blog database from env variables and put the output in the out directory.
  • Compare the out/reference.md to fixtures/reference.md. If they're different, then something is broken ;)

Preprocess images to files

Add an option to preprocess all images and put them as files in a directory of the article for the blogging engine to later process and post as an asset.

That way, user's blog can optimize images if it chooses to, and it can put them on a CDN of their choice.

Convert: add a way to override templates by creating .notoma/templates/*.j2

Provide a way for users to override templates by providing their own Jinja templates.

  • Docs: Write down the list of available blocks and their accessible attributes
  • Docs: Write down available template helper functions
  • Implementation: Add a template lookup in ($pwd)/.notoma/templates/{block_type}.j2. If the template exists there, try using that when encounteringz block of typeblock_type in Notion.
  • Docs: Add docs on when and why to use custom templates, and add a couple examples.

Automate pypi releases

Extend the GH actions set from #18 (release automation) to include automating a release to pypi on tags.

Automatically build and upload Github Releases

Before I extend the features further, I want to work with some more Github Actions. ;-)

  • Add the GH action that drafts the release notes based of the merged RPs. release-drafter I think.
  • Add a GH action to package the release files on tags, and publish the drafted release.

Related:

  • Switch to Poetry and remove other deps and release management systems.

Add a Homebrew release

Notoma is currently available as a pypi package. This is very python-specific, and it should also be available via brew install xnutsive/notoma/notoma.

Ideally, add a GH action that bundles the release (if the CI is green), and pushes that release to pypi and makes it available via brew.

Todo

  • Add the brew Formula in a separate repo, check that brew install xnutsive/notoma/notoma works correctly.

Extracted the rest into #18.

Convert: support @-links to other pages in the blog

Support @-links in Notion to other pages in the same Notion Database (blog).

To do that, Notoma needs to know the URL structure of the blog engine that the user is using after the conversion to .md — it can't just link to another .md file.

Behavior

  1. When parsing each page, if the page has @-links to other pages, try processing each link and replacing it with the link to the blog page corresponding to the linked Notion page.
  2. If the link is to a Notion page that is not in the same database, don't process it and keep the Notion.so URL.
  3. If the link is in the same database (same blog), try guessing the URL structure.
  4. If the URL structure can't be detected, log an error and keep the link.

Implementation details

Unfortunately, every static gen engine has their own permalink pattern (URL structure), that can also be tweaked in the engine config.

So this behavior will only work for some engines, that Notoma will have to detect, and read their configs. Most of the configs are just YAML or JSON anyway.

Alternatively, Notoma can ask for a permalink format and have it's own permalink setting. That would be easier.

"jinja2.exceptions.TemplateNotFound: post.md.j2" with posts duiplicated from example

Input url: https://www.notion.so/kaedea/5e23a71aa5904f3f8589a613a6dc1e81?v=8f7047c7b1b34538909dca1c64277787

then outcomed the following error:

Traceback (most recent call last):
  File "/usr/local/bin/notoma", line 8, in <module>
    sys.exit(runner())
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/notoma/cli.py", line 76, in convert
    __convert_pages(published_pages(blog), dest, config, verbose)
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/notoma/cli.py", line 110, in __convert_pages
    page_to_markdown(page, config=config)
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/notoma/core.py", line 48, in page_to_markdown
    return load_template("post", debug=True, config=config).render(
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/notoma/templates.py", line 59, in load_template
    return env.get_template(f"{name}.md.j2")
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/jinja2/environment.py", line 838, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/jinja2/environment.py", line 812, in _load_template
    template = self.loader.load(self, name, globals)
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/jinja2/loaders.py", line 112, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "/usr/local/Cellar/notoma/0.2.1/libexec/lib/python3.9/site-packages/jinja2/loaders.py", line 289, in get_source
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: post.md.j2

Config: subcommand for viewing or storing config values

notoma config # shows the current value for all settings in .env, and all required settings in Config class that are undefined.

notoma config set key value # saves the new value for the key to .env

notoma config unset key # removes the value for the key from .env

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.