html_url,id,node_id,tag_name,target_commitish,name,draft,author,author_label,prerelease,created_at,published_at,body,repo,repo_label,reactions https://github.com/simonw/datasette/releases/tag/0.40,25748264,MDc6UmVsZWFzZTI1NzQ4MjY0,0.40,master,0.40,0,9599,simonw,0,2020-04-22T04:06:39Z,2020-04-22T04:06:51Z,"* Datasette [Metadata](https://datasette.readthedocs.io/en/latest/metadata.html) can now be provided as a YAML file as an optional alternative to JSON. See [Using YAML for metadata](https://datasette.readthedocs.io/en/latest/metadata.html#metadata-yaml). (#713) * Removed support for `datasette publish now`, which used the the now-retired Zeit Now v1 hosting platform. A new plugin, [datasette-publish-now](https://github.com/simonw/datasette-publish-now), can be installed to publish data to Zeit ([now Vercel](https://vercel.com/blog/zeit-is-now-vercel)) Now v2. (#710) * Fixed a bug where the `extra_template_vars(request, view_name)` plugin hook was not receiving the correct `view_name`. (#716) * Variables added to the template context by the `extra_template_vars()` plugin hook are now shown in the `?_context=1` debugging mode (see [template_debug](https://datasette.readthedocs.io/en/latest/config.html#config-template-debug)). (#693) * Fixed a bug where the “templates considered” HTML comment was no longer being displayed. (#689) * Fixed a `datasette publish` bug where `--plugin-secret` would over-ride plugin configuration in the provided `metadata.json` file. (#724) * Added a new CSS class for customizing the canned query page. (#727)",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.25.1,14560294,MDc6UmVsZWFzZTE0NTYwMjk0,0.25.1,master,Datasette 0.25.1,0,9599,simonw,0,2018-11-05T06:31:41Z,2018-12-16T21:44:27Z,"Documentation improvements plus a fix for publishing to Zeit Now. * `datasette publish now` now uses Zeit’s v1 platform, to work around the new 100MB image limit. Thanks, @slygent - closes #366. ",107914493,datasette, https://github.com/simonw/datasette/releases/tag/0.14,8841695,MDc6UmVsZWFzZTg4NDE2OTU=,0.14,main,Datasette 0.14: customization edition,0,9599,simonw,0,2017-12-10T01:33:24Z,2017-12-10T01:41:14Z,"The theme of this release is customization: Datasette now allows every aspect of its presentation [to be customized](http://datasette.readthedocs.io/en/latest/custom_templates.html) either using additional CSS or by providing entirely new templates. Datasette's [metadata.json format](http://datasette.readthedocs.io/en/latest/metadata.html) has also been expanded, to allow per-database and per-table metadata. A new `datasette skeleton` command can be used to generate a skeleton JSON file ready to be filled in with per-database and per-table details. The `metadata.json` file can also be used to define [canned queries](http://datasette.readthedocs.io/en/latest/sql_queries.html#canned-queries), as a more powerful alternative to SQL views. - `extra_css_urls`/`extra_js_urls` in metadata A mechanism in the `metadata.json` format for adding custom CSS and JS urls. Create a `metadata.json` file that looks like this: { ""extra_css_urls"": [ ""https://simonwillison.net/static/css/all.bf8cd891642c.css"" ], ""extra_js_urls"": [ ""https://code.jquery.com/jquery-3.2.1.slim.min.js"" ] } Then start datasette like this: datasette mydb.db --metadata=metadata.json The CSS and JavaScript files will be linked in the `` of every page. You can also specify a SRI (subresource integrity hash) for these assets: { ""extra_css_urls"": [ { ""url"": ""https://simonwillison.net/static/css/all.bf8cd891642c.css"", ""sri"": ""sha384-9qIZekWUyjCyDIf2YK1FRoKiPJq4PHt6tp/ulnuuyRBvazd0hG7pWbE99zvwSznI"" } ], ""extra_js_urls"": [ { ""url"": ""https://code.jquery.com/jquery-3.2.1.slim.min.js"", ""sri"": ""sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g="" } ] } Modern browsers will only execute the stylesheet or JavaScript if the SRI hash matches the content served. You can generate hashes using - Auto-link column values that look like URLs ([\#153](https://github.com/simonw/datasette/issues/153)) - CSS styling hooks as classes on the body ([\#153](https://github.com/simonw/datasette/issues/153)) Every template now gets CSS classes in the body designed to support custom styling. The index template (the top level page at `/`) gets this: The database template (`/dbname/`) gets this: The table template (`/dbname/tablename`) gets: The row template (`/dbname/tablename/rowid`) gets: The `db-x` and `table-x` classes use the database or table names themselves IF they are valid CSS identifiers. If they aren't, we strip any invalid characters out and append a 6 character md5 digest of the original name, in order to ensure that multiple tables which resolve to the same stripped character version still have different CSS classes. Some examples (extracted from the unit tests): ""simple"" => ""simple"" ""MixedCase"" => ""MixedCase"" ""-no-leading-hyphens"" => ""no-leading-hyphens-65bea6"" ""_no-leading-underscores"" => ""no-leading-underscores-b921bc"" ""no spaces"" => ""no-spaces-7088d7"" ""-"" => ""336d5e"" ""no $ characters"" => ""no--characters-59e024"" - `datasette --template-dir=mytemplates/` argument You can now pass an additional argument specifying a directory to look for custom templates in. Datasette will fall back on the default templates if a template is not found in that directory. - Ability to over-ride templates for individual tables/databases. It is now possible to over-ride templates on a per-database / per-row or per-table basis. When you access e.g. `/mydatabase/mytable` Datasette will look for the following: - table-mydatabase-mytable.html - table.html If you provided a `--template-dir` argument to datasette serve it will look in that directory first. The lookup rules are as follows: Index page (/): index.html Database page (/mydatabase): database-mydatabase.html database.html Table page (/mydatabase/mytable): table-mydatabase-mytable.html table.html Row page (/mydatabase/mytable/id): row-mydatabase-mytable.html row.html If a table name has spaces or other unexpected characters in it, the template filename will follow the same rules as our custom `` CSS classes - for example, a table called ""Food Trucks"" will attempt to load the following templates: table-mydatabase-Food-Trucks-399138.html table.html It is possible to extend the default templates using Jinja template inheritance. If you want to customize EVERY row template with some additional content you can do so by creating a row.html template like this: {% extends ""default:row.html"" %} {% block content %}

EXTRA HTML AT THE TOP OF THE CONTENT BLOCK

This line renders the original block:

{{ super() }} {% endblock %} - `--static` option for datasette serve ([\#160](https://github.com/simonw/datasette/issues/160)) You can now tell Datasette to serve static files from a specific location at a specific mountpoint. For example: datasette serve mydb.db --static extra-css:/tmp/static/css Now if you visit this URL: http://localhost:8001/extra-css/blah.css The following file will be served: /tmp/static/css/blah.css - Canned query support. Named canned queries can now be defined in `metadata.json` like this: { ""databases"": { ""timezones"": { ""queries"": { ""timezone_for_point"": ""select tzid from timezones ..."" } } } } These will be shown in a new ""Queries"" section beneath ""Views"" on the database page. - New `datasette skeleton` command for generating `metadata.json` ([\#164](https://github.com/simonw/datasette/issues/164)) - `metadata.json` support for per-table/per-database metadata ([\#165](https://github.com/simonw/datasette/issues/165)) Also added support for descriptions and HTML descriptions. Here's an example metadata.json file illustrating custom per-database and per-table metadata: { ""title"": ""Overall datasette title"", ""description_html"": ""This is a description with HTML."", ""databases"": { ""db1"": { ""title"": ""First database"", ""description"": ""This is a string description & has no HTML"", ""license_url"": ""http://example.com/"", ""license"": ""The example license"", ""queries"": { ""canned_query"": ""select * from table1 limit 3;"" }, ""tables"": { ""table1"": { ""title"": ""Custom title for table1"", ""description"": ""Tables can have descriptions too"", ""source"": ""This has a custom source"", ""source_url"": ""http://example.com/"" } } } } } - Renamed `datasette build` command to `datasette inspect` ([\#130](https://github.com/simonw/datasette/issues/130)) - Upgrade to Sanic 0.7.0 ([\#168](https://github.com/simonw/datasette/issues/168)) - Package and publish commands now accept `--static` and `--template-dir` Example usage: datasette package --static css:extra-css/ --static js:extra-js/ \ sf-trees.db --template-dir templates/ --tag sf-trees --branch master This creates a local Docker image that includes copies of the templates/, extra-css/ and extra-js/ directories. You can then run it like this: docker run -p 8001:8001 sf-trees For publishing to Zeit now: datasette publish now --static css:extra-css/ --static js:extra-js/ \ sf-trees.db --template-dir templates/ --name sf-trees --branch master - HTML comment showing which templates were considered for a page ([\#171](https://github.com/simonw/datasette/issues/171)) ",107914493,datasette,