Coder Social home page Coder Social logo

urltomarkdown's Introduction

Convert a webpage to markdown

Provides a web service that downloads a requested web page and outputs a markdown version.

Example request, supply url:

GET https://urltomarkdown.herokuapp.com/?url=https%3A%2F%2Fwww.mozilla.org%2Fen-GB%2Ffirefox%2F

Response:

Meet our family of products
---------------------------

*   [![](https://www.mozilla.org/media/protocol/img/logos/firefox/browser/logo.eb1324e44442.svg)  

	...

[Join Firefox](https://accounts.firefox.com/signup?entrypoint=mozilla.org-firefox_home&form_type=button&utm_source=mozilla.org-firefox_home&utm_medium=referral&utm_campaign=firefox-home&utm_content=secondary-join-firefox) [Learn more about joining Firefox](https://www.mozilla.org/en-GB/firefox/accounts/)

Optionally request inline title:

GET https://urltomarkdown.herokuapp.com/?url=https%3A%2F%2Fwww.mozilla.org%2Fen-GB%2Ffirefox%2F&title=true

Response:

# Firefox - Protect your life online with privacy-first products โ€” Mozilla (UK)
Meet our family of products
---------------------------
	...

Title is also returned in HTTP header.

X-Title: Firefox%20-%20Protect%20your%20life%20online%20with%20privacy-first%20products%20%E2%80%94%20Mozilla%20(UK)

Optionally suppress links:

GET https://urltomarkdown.herokuapp.com/?url=https%3A%2F%2Fwww.mozilla.org%2Fen-GB%2Ffirefox%2F&links=false

Alternative POST request, supply url and html in POST body:

POST https://urltomarkdown.herokuapp.com/?title=true&links=false
	
	url=https%3A%2F%2Fwww.mozilla.org%2Fen-GB%2Ffirefox%2F
	
	html=%3C!doctype%20html%3E%3Chtml%20...

See API Documentation

Inspired by Heck Yeah Markdown

Also of interest:

Bookmarklet

A bookmarklet for SimpleNote on iOS/iPadOS (based on simpleclip):

javascript:(
	function()
	{
		var request=new XMLHttpRequest();
		var url="https://urltomarkdown.herokuapp.com/?url="+encodeURIComponent(location.href);
		request.onreadystatechange=function()		{
			if(request.readyState==4&&request.status==200) {
				let text = '# ' + decodeURIComponent(request.getResponseHeader('X-Title')) +  '\n' + request.responseText;
				location.href="simplenote://new?content="+encodeURIComponent(text);

			}
		};
		request.open("GET",url, true);
		request.send();
		}
)();

Safari Snippets

Using Safari Snippets to inject the following code solves the issue that some sites prevent javascript bookmarklets accessing a resource on a different domain

var request=new XMLHttpRequest();
var herokuurl="https://urltomarkdown.herokuapp.com/";

request.onreadystatechange=function()	
{
		if(request.readyState==4&&request.status==200) {
		let text = '# ' + decodeURIComponent(request.getResponseHeader('X-Title')) +  '\n' + request.responseText;
		location.href="simplenote://new?content="+encodeURIComponent(text);
		}
};

request.open("POST", herokuurl, true);
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
html=document.documentElement.innerHTML;
request.send("html="+encodeURIComponent(html)+"&url="+encodeURIComponent(window.location.href));

urltomarkdown's People

Contributors

macsplit avatar

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.