mirror of
				https://git.proxmox.com/git/proxmox-widget-toolkit
				synced 2025-11-04 02:58:54 +00:00 
			
		
		
		
	Define our own, rather minimal interface so that we change the parser under the hood if ever needed, I already did so once during evaluating this, as first I checked out Snarkdown[0], which is really nice for the few lines of code it needs, but is a bit to limited for the use case. Currently marked[1] is used, provided by the libjs-marked Debian package. For now statically link the marked parser in on built time to avoid the need to add new directories to serve in our pve/pmg/pbs proxies. This is a bit ugly but can be cleaned up afterwards transparently too. We sanitize the produced HTML ourselves (most MD JS parser/renderer don't do that) by creating a real, but not active, DOM tree and recursively prune bad nodes/attrs from it and let it spit out HTML again at the end. While a tad inefficient it really won't matter for our use case, as the notes/comments we render are only a few KiB of text and it's done on the client side anyway. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
		
			
				
	
	
		
			27 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
Copyright (C) 2010-2021 Proxmox Server Solutions GmbH
 | 
						|
 | 
						|
This software is written by Proxmox Server Solutions GmbH <support@proxmox.com>
 | 
						|
 | 
						|
License: AGPLv3
 | 
						|
 This program is free software: you can redistribute it and/or modify
 | 
						|
 it under the terms of the GNU Affero General Public License as published by
 | 
						|
 the Free Software Foundation, either version 3 of the License, or
 | 
						|
 (at your option) any later version.
 | 
						|
 .
 | 
						|
 This program is distributed in the hope that it will be useful,
 | 
						|
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						|
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
						|
 GNU Affero General Public License for more details.
 | 
						|
 .
 | 
						|
 You should have received a copy of the GNU Affero General Public License
 | 
						|
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
						|
 | 
						|
Marked:
 | 
						|
 The Marked JavaScript library is shipped through linkage from the Debian
 | 
						|
 package unmodified alongside proxmox-widget-toolkit.
 | 
						|
 | 
						|
 Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/) Copyright (c)
 | 
						|
 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
 | 
						|
 | 
						|
 For the license and copyright details see `/usr/share/doc/libjs-marked/copyright`
 |