@@ -3,7 +3,10 @@ use crate::{templates::docs::TocLink, utils::config};
33use std:: cell:: RefCell ;
44use std:: collections:: { HashMap , HashSet } ;
55use std:: path:: { Path , PathBuf } ;
6- use std:: sync:: Arc ;
6+ use std:: sync:: {
7+ atomic:: { AtomicUsize , Ordering } ,
8+ Arc ,
9+ } ;
710
811use aho_corasick:: { AhoCorasick , AhoCorasickBuilder , MatchKind } ;
912use anyhow:: Result ;
@@ -13,7 +16,6 @@ use comrak::{
1316 nodes:: { Ast , AstNode , NodeValue } ,
1417 parse_document, Arena , ComrakExtensionOptions , ComrakOptions , ComrakRenderOptions ,
1518} ;
16- use convert_case:: Casing ;
1719use itertools:: Itertools ;
1820use lazy_static:: lazy_static;
1921use tantivy:: collector:: TopDocs ;
@@ -26,17 +28,23 @@ use url::Url;
2628use crate :: templates:: docs:: NavLink ;
2729use std:: fmt;
2830
29- pub struct MarkdownHeadings { }
31+ pub struct MarkdownHeadings {
32+ counter : Arc < AtomicUsize > ,
33+ }
3034
3135impl MarkdownHeadings {
3236pub fn new ( ) ->Self {
33- Self { }
37+ Self {
38+ counter : Arc :: new ( AtomicUsize :: new ( 0 ) ) ,
39+ }
3440}
3541}
3642
3743impl HeadingAdapter for MarkdownHeadings {
3844fn enter ( & self , meta : & HeadingMeta ) ->String {
39- let id = meta. content . to_case ( convert_case:: Case :: Kebab ) ;
45+ // let id = meta.content.to_case(convert_case::Case::Kebab);
46+ let id =self . counter . fetch_add ( 1 , Ordering :: SeqCst ) ;
47+ let id =format ! ( "header-{}" , id) ;
4048
4149match meta. level {
42501 =>format ! ( r#"<h1 class="h1 mb-5" id="{id}">"# ) ,
@@ -217,7 +225,9 @@ impl SyntaxHighlighterAdapter for SyntaxHighlighter {
217225let code =match options. lang {
218226"postgresql" |"sql" |"postgresql-line-nums" =>{
219227lazy_static ! {
220- static refSQL_KEYS : [ & ' static str ; 66 ] =[
228+ static refSQL_KEYS : [ & ' static str ; 68 ] =[
229+ "PARTITION OF" ,
230+ "PARTITION BY" ,
221231"CASCADE" ,
222232"INNER " ,
223233"ON " ,
@@ -285,7 +295,9 @@ impl SyntaxHighlighterAdapter for SyntaxHighlighter {
285295"pgml.predict" ,
286296"pgml.transform" ,
287297] ;
288- static refSQL_KEYS_REPLACEMENTS : [ & ' static str ; 66 ] =[
298+ static refSQL_KEYS_REPLACEMENTS : [ & ' static str ; 68 ] =[
299+ r#"<span class="syntax-highlight">PARTITION OF</span>"# ,
300+ r#"<span class="syntax-highlight">PARTITION BY</span>"# ,
289301"<span class=\" syntax-highlight\" >CASCADE</span>" ,
290302"<span class=\" syntax-highlight\" >INNER </span>" ,
291303"<span class=\" syntax-highlight\" >ON </span>" ,