Skip to main content

markdown-google-map

Python markdown extension for Google Maps. Should be loaded as an extension to the markdown library.

Installation:

pip install mdx-google-map

Usage:

import markdown

md = markdown.Markdown(extensions=["mdx_google_map"])
md.convert("[map:Central Paris]")

Or if you want to alter the config:

import markdown
from mdx_google_map import GoogleMapExtension

md = markdown.Markdown(extensions=[GoogleMapExtension(...config values...)])
md.convert("[map:Central Paris]")

Markdown syntax:

It's pretty simple:

Hey look at my map!
[map:City of London]

Which will output:

<p>
Hey look at my map!
<iframe allowfullscreen="true" frameborder="0" height="300" src="//www.google.com/maps/embed/v1/place?key=AIzaSyD5DlGo1lo0V2Np7TxfpuNuWbWcr5TV8Sw&amp;q=City+of+London" width="500"></iframe>
</p>

Configuring:

You will need an API Key from Google to use the Maps APIs, once obtained it can be configured as an environment variable:

$ export GOOGLE_API_KEY=MyGoogleAPIKey1234

or simply passed through to the extension as with any other config:

GoogleMapExtension(google_api_key='MyGoogleAPIKey1234')

You can also load the API key by passing a callable that conforms to the same syntax as dict.get('KEY', 'default value'). This is more of an implementation detail, but it is supported if you find the need.

my_dict = {'GOOGLE_API_KEY': 'MyGoogleAPIKey1234'}

GoogleMapExtension(config_getter=my_dict.get)

Explicitly passing the google_api_key config param takes precedence over other methods of setting the API Key.

All other config is optional and detailed below

Config is passed through when loading the extension as with the API Key example above:

GoogleMapExtension(width='500', height='400', ...)

  • width: Sets width of iframe. Default is 500
  • height: Sets height of iframe. Default is 300
  • fluid: If True the iframe will be wrapped in a styled outer div set to 100% width. This will make the iframe expand to full width of the page (or any other container you put it in) fluidly, whilst maintaining the same aspect ratio. Default is False.

Contributing

Pull requests are welcome, though we'd be grateful if you would open an issue to discuss your feature/bugfix first.

To install the development dependencies locally it's: $ pip install -e .[dev]

To run the tests it is just: $ python -m unittest

You'll need to follow PEP8 in addition to the Google Python Style Guide. Sensible deviations from the above will be considered.

Metadata

Release files for mdx-google-map 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mdx-google-map 1.0.1
File Size Uploaded Provenance
mdx_google_map-1.0.1.tar.gz 4.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mdx-google-map 1.0.1
File Interpreter ABI Platform
mdx_google_map-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / mdx_google_map-1.0.1.tar.gz

Download URL mdx_google_map-1.0.1.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ce41990093b7922c2cc65478cac6801c175462aeddfc00bb7964421b59672847
BLAKE2b-256 checksum
How to use checksums
e0d3dc1e9527eed64a8a0357d97df5ef64890ab97b0c81c1952ba3f7629d3a96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.4

Release files / mdx_google_map-1.0.1-py3-none-any.whl

Download URL mdx_google_map-1.0.1-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5b2d1149c28fb8c24029aaf33375cd99882e981634274ed2b121ca7ec31083b
BLAKE2b-256 checksum
How to use checksums
1066716f30560274cdb2dcba05b4bc85872a1637b549438517b3f435829a09de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.4

Security for mdx-google-map 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page